Web Server Apache2 With Php5
Web Server Apache2 With Php5
Web Server Apache2 With Php5
vim /etc/apt/sources.list
# PHP-FPM
deb http://packages.dotdeb.org stable all
aptitude install apache2 apache2-mpm-worker libapache2-mod-fastcgi php5-fpm
a2enmod actions fastcgi
vim /etc/apache2/mods-enabled/fastcgi.conf
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /cgi-bin/php5.external
<Location "/cgi-bin/php5.external">
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS
</Location>
</IfModule>
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi .php
#FastCgiWrapper /usr/lib/apache2/suexec
FastCgiIpcDir /var/lib/apache2/fastcgi
</IfModule>
vim /etc/apache2/sites-available/web.go.conf
#<Directory /var/www/development.propertykita.com>
# AllowOverride None
# Order Deny,Allow
# Deny from all
#</Directory>
<VirtualHost *:80>
DocumentRoot /var/www/web.go/web/
ServerName web.go
ServerAdmin [email protected]
FastCgiExternalServer /var/www/web.go/cgi-bin/php5.external -socket
/var/run/php5-fpm-web.go.com.sock
#-pass-header Authorization
# Action application/x-httpd-php php5-fcgi
AddHandler php5-fcgi .php .html .htm
Action php5-fcgi /cgi-bin/php5.external
Alias /cgi-bin /var/www/web.go/cgi-bin
<Directory /var/www/web.go/web>
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from all
# AddType text/html .html
# AddOutputFilter INCLUDES .html
# Options +Includes
</Directory>
# eliminate log warning about ico
# Redirect 404 /favicon.ico
#<Location /favicon.ico>
# ErrorDocument 404 "No favicon"
#</Location>
# *.php3-5 file extension (enable different extensions in
/etc/php5/fpm/pool.d/development.propertykita.com.conf first)
# <FilesMatch ".+\.ph(p[345]?|t|tml)$">
# SetHandler application/x-httpd-php
# </FilesMatch>
# FastCGI
# Action application/x-httpd-php php5-fcgi
# AddHandler php5-fcgi .php
# Action php5-fcgi /cgi-bin/php5.external
# Alias /cgi-bin /var/www/development.propertykita.com/cgi-bin
# <Directory "/var/www/development.propertykita.com/cgi-bin">
# deny from all
# Options +ExecCGI
# AllowOverride AuthConfig
# Order deny,allow
# </Directory>
# FastCgiExternalServer /var/www/development.propertykita.com/cgi-
bin/php5.external -socket /var/run/php5-fpm-development.propertykita.com.sock
#-pass-header Authorization
# AddHandler php5-fcgi .php
# Action php5-fcgi /cgi-bin/php5.external
# Alias /cgi-bin /var/www/development.propertykita.com/cgi-bin
# FastCgiExternalServer /var/www/development.propertykita.com/cgi-
bin/php5.external -socket /var/run/php5-fpm/dev.soc
# Alias /cgi-bin/ /var/www/development.propertykita.com/cgi-bin/
# apache logs
ErrorLog /var/log/web/web.go.error.log
LogLevel warn
CustomLog /var/log/web/web.go.access.log combined
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/web.go/web/
ServerName web.go
ServerAdmin [email protected]
FastCgiExternalServer /var/www/web.go/cgi-bin/php5.external -socket
/var/run/php5-fpm-web.go.sock
AddHandler php5-fcgi .php .html .htm .php5
Action php5-fcgi /cgi-bin/php5.external
Alias /cgi-bin /var/www/web.go/cgi-bin
<Directory /var/www/web.go/web>
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/web/web.go.error.log
LogLevel warn
CustomLog /var/log/web/web.go.access.log combined
</VirtualHost>
vim /etc/php5/fpm/pool.d/web.go.conf
[web.go]
listen = /var/run/php5-fpm/web.go.soc
user = prokit
group = www-data
listen.owner = prokit
listen.group = www-data
listen.mode = 0666
pm = dynamic
pm.max_children = 20
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 10
php_admin_value[open_basedir]=/var/www/web.go/web
:/usr/share/phpmyadmin
php_admin_value[session.save_path]=/var/www/web.go/tmp
php_admin_value[upload_tmp_dir]=/var/www/web.go/tmp
php_admin_value[memory_limit] = 128M
php_admin_value[upload_max_filesize] = 100M
php_admin_value[post_max_size] = 100M
[test.co]
chdir = /
user = prokit
group = www-data
pm = dynamic
pm.start_servers = 5
pm.min_spare_servers = 2
pm.max_spare_servers = 10
pm.max_children = 50
pm.process_idle_timeout = 10s
pm.max_requests = 10000
listen.mode = 0775
listen.owner = prokit
listen.group = www-data
listen = /var/run/php5-fpm-web.go.sock
security.limit_extensions =; Any, handled via Apache.
php_admin_value[open_basedir]=/var/www/web.go/web
php_admin_value[session.save_path]=/var/www/web.go/tmp
php_admin_value[upload_tmp_dir]=/var/www/web.go/tmp
php_admin_value[memory_limit] = 128M
php_admin_value[upload_max_filesize] = 100M
php_admin_value[post_max_size] = 100M
adduser prokit
/etc/init.d/apache2 restart
/etc/init.d/php5-fpm restart
vim /etc/hosts
192.168.1.226 web.localdomain web
ls -l /var/run/
mkdir -p /var/www/web.go/web
mkdir -p /var/www/web.go/cgi-bin
mkdir -p /var/www/web.go/tmp
mkdir -p /var/www/web.go/sessions
mkdir -p /var/www/web.go/logs
mkdir /var/log/web
/var/www/web.go/web/index.html
/var/www/web.go/web/index.php
chown www-dev:www-dev -R /var/www/web.go/
ls -l /var/www/web.go/web/
cd /etc/apache2/sites-enabled/
ls -l ../sites-available/web.go.conf web.go.conf
a2ensite web.go.conf
/etc/init.d/apache2 restart
/etc/init.d/php5-fpm restart
unlink /etc/apache2/sites-enabled/000-default.conf
http://zeldor.biz/2011/03/apache2-and-php5-fpm-combination/