Setting up Apache 2.2 + FastCGI + SuExec + PHP-FPM on Centos 6
Posted
by
mr1031011
on Server Fault
See other posts from Server Fault
or by mr1031011
Published on 2013-10-31T17:06:16Z
Indexed on
2013/11/03
3:57 UTC
Read the original article
Hit count: 578
I'm trying to follow this very detailed instruction here, I simply changed from www-data user to apache user, and is using /var/www/hosts/sitename/public_html instead of /home/user/public_html
However, I spent the whole day trying to figure out why the php file content is displayed without being parsed correctly. I just cant's seem to figure this out. Below is my current config:
/etc/httpd/conf.d/fastcgi.conf
User apache
Group apache
LoadModule fastcgi_module modules/mod_fastcgi.so
# dir for IPC socket files
FastCgiIpcDir /var/run/mod_fastcgi
# wrap all fastcgi script calls in suexec
FastCgiWrapper On
# global FastCgiConfig can be overridden by FastCgiServer options in vhost config
FastCgiConfig -idle-timeout 20 -maxClassProcesses 1
# sample PHP config
# see /usr/share/doc/mod_fastcgi-2.4.6 for php-wrapper script
# don't forget to disable mod_php in /etc/httpd/conf.d/php.conf!
#
# to enable privilege separation, add a "SuexecUserGroup" directive
# and chown the php-wrapper script and parent directory accordingly
# see also http://www.brandonturner.net/blog/2009/07/fastcgi_with_php_opcode_cache/
#
FastCgiServer /var/www/www-data/php5-fcgi
#AddType application/x-httpd-php .php
AddHandler php-fcgi .php
Action php-fcgi /fcgi-bin/php5-fcgi
Alias /fcgi-bin/ /var/www/www-data/
#FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /tmp/php5-fpm.sock -pass-header Authorization
#DirectoryIndex index.php
#
<Location /fcgi-bin/>
# Order Deny,Allow
# Deny from All
# Allow from env=REDIRECT_STATUS
SetHandler fcgid-script
Options +ExecCGI
</Location>
/etc/httpd/conf.d/vhost.conf
<VirtualHost>
DirectoryIndex index.php index.html index.shtml index.cgi
SuexecUserGroup www.mysite.com mygroup
Alias /fcgi-bin/ /var/www/www-data/www.mysite.com/
DocumentRoot /var/www/hosts/mysite.com/w/w/w/www/
<Directory /var/www/hosts/mysite.com/w/w/w/www/>
Options -Indexes FollowSymLinks
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
PS: 1. Also, with PHP5.5, do I even need FPM or is it already included? 2. I'm using mod_fastcgi, not sure if this is the problem and it I should switch to mod_fcgid? There seems to be conflicting records on the internet considering which one is better. I have many virtual hosts running on the machine and hope to be able to provide each user with their own opcache
© Server Fault or respective owner