Install Virtualbox – CentOS 7
Virtualbox is great, it let's you run multiple operating systems on one machine while being…
Mod Security isn’t ready for NGINX yet, even though the ModSec website says a stable version for NGINX is available it still lacks important features. Because of this I’ve had to stick to Apache, but why not then make use if PHP-FPM. PHP-FPM, if configured accordingly, allows you to setup account specific limits.
To get this done start by install the epel-release repo:
Install Apache 2.4 and for good measure, install the devel package as well.
Next up install php-fpm. Note: Previously you needed to install mod_fastcgi but since Apache 2.4 we use mod_proxy_fcgi
Starting from release 5.3.3 in early 2010, PHP has merged the php-fpm fastCGI process manager into its codebase, and it is now (as of 5.4.1) quite stable.
php-fpm was previously found at http://php-fpm.org/
This means that we can now run secure, fast, and dependable PHP code using only the stock apache httpd and php.net releases; no more messing around with suphp or suexec - or, indeed, mod_php.
Enable Apache and PHP-FPM to start at startup
Start both services:
As of now, you’ve installed both Apache 2.4 and PHP-FPM but Apache doesn’t know how to call PHP-FPM, let’s do that below:
Create two folders inside /etc/httpd/
Create a file inside /etc/httpd/sites-available named test.com.conf
Create the required folders
Create a symlink of this file to /etc/httpd/sites-enabled
Configure Apache to read the conf files from the /etc/httpd/sites-enabled folder. Add the following line at the end of /etc/httpd/conf/httpd.conf
Now, navigate to /etc/php-fpm.d and either duplicate the www.conf or create a new file test.com.conf and add the following to it
Now add a user to the system
The user in this case is test.com. Issue the following to change ownership of it’s home directory and give it to the user test.com
Make sure the folder permissions are set to 0755 and file permissions to 0644. With the setup above, you won’t need to set the permission 777 to files and folders to write to them.
Restart Apache and PHP-FPM
Throw a file in /var/www/vhosts/test.com/httpdocs/ to verify things work
If everything goes fine, you should something like below