我运行以下命令来找出php-fpm占用的端口
netstat -pl | grep fpm
(No info could be read for "-p": geteuid()=1000 but you should be root.)
unix 2 [ ACC ] STREAM LISTENING 9500 - /var/run/php5-fpm.sock
我的web配置文件中有以下proxypassmatch
ProxyPassMatch ^/(.+\.php.*)$ fcgi://127.0.0.1:9500/var/www/html/$1 timeout=1800
我已经安装了所有必要的依赖项来处理php fpm作为fastcgi模块。
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
<Directory /usr/lib/cgi-bin>
Options ExecCGI FollowSymLinks
SetHandler fastcgi-script
Require all granted
</Directory>
</IfModule>
我的VirtualHost指令在以下集合中:
<VirtualHost *:443>
ServerName domain.com
ServerAlias www.domain.com
SSLEngine on
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
SSLCertificateFile /etc/apache2/ssl/private/ec1ed7d470bd0db4.crt
SSLCertificateKeyFile /etc/apache2/ssl/private/.key
SSLCertificateChainFile /etc/apache2/ssl/.crt
DocumentRoot /var/www/html/dir
# Setup php-fpm to process php files
# ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9500/var/www/html/dir/$1
# ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
ProxyPassMatch ^/(.+\.php.*)$ fcgi://127.0.0.1:9500/var/www/html/$1 timeout=1800
</VirtualHost>
重启Apache和php fpm后,我仍然收到以下消息
Service Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems