Currently I am using Apache in a server with WHM/Cpanel and I'm currently using Prefork MPM with Mod Ruid2 to process PHP pages. While the setup allows it to run very fast, I'm limited to processing about 80 HTTP requests simultaneously since the machine has 8 GB ram.
I think google isn't happy enough with that. I feel to make my websites and the server keep up with the times, I need to increase the maximum number of requests that can be served at once.
So I thought of using FastCGI with PHP-FPM. I then began playing with my httpd.conf (on my own private test server of course) to see how to configure it for multiple users. Each user has its own domain on the server.
For now I am showing my configuration for one user. His website is 127.0.0.1:81
. /daemon
is a folder accessible by user daemon.
This is my php fpm config file that I apply when I execute php-fpm daemon.
[global]
pid = /daemon/x.pid
daemonize = yes
[www]
user = daemon
group = daemon
listen = /daemon/x.sock
listen.owner=daemon
listen.group=daemon
listen.backlog = 65534
pm = static
pm.max_children = 10
pm.max_requests = 10000
pm.status_path = /STAT
request_terminate_timeout = 100s
clear_env = no
security.limit_extensions=.php
This is the snippet in my httpd.conf file
<virtualhost 127.0.0.1:81>
AddHandler php51 .php
Action php51 /php51
Alias /php51 /daemon/1
FastCgiExternalServer /daemon/1 -socket /daemon/x.sock -pass-header Authorization -idle-timeout 120 -flush
<Directory "/daemon">
Order allow,deny
Allow from all
</Directory>
ServerName 127.0.0.1
</virtualhost>
What I want to do is try to compress these lines so that when I go do a multi-user setup, the amount of typing I have to do will be less.
Because I felt theres some redundancy, I replaced:
Alias /php51 /daemon/1
FastCgiExternalServer /daemon/1 -socket /daemon/x.sock -pass-header Authorization -idle-timeout 120 -flush
with:
# Alias /php51 /daemon/1
FastCgiExternalServer /php51 -socket /daemon/x.sock -pass-header Authorization -idle-timeout 120 -flush
and restarted apache and attempted to access a php file and I'm told the file was not found, yet I never modified the file itself and I used the same URL in both tests.
Also, in the apache log, I received:
File does not exist: /usr/local/apache2/htdocs/php51
When I removed:
<Directory "/daemon">
Order allow,deny
Allow from all
</Directory>
I received "permission denied".
I never had to add all this configuration when using prefork with ruid2.
Is there a more minimal configuration I can use other than having to define an action, alias on top of defining an external server? I want to increase the number of connections apache can handle without eating all the memory or even eating the CPU and I want to be able to use PHP as well.