我讀本文用mod_fastcgi設定虛擬主機,但我不太明白以下配置:
FastCgiExternalServer /var/www/php5.external -host 127.0.0.1:9000
AddHandler php5-fcgi .php
Action php5-fcgi /usr/lib/cgi-bin/php5.external
Alias /usr/lib/cgi-bin/ /var/www/
有人可以解釋一下嗎?
編輯:令我困惑的是為什麼這裡要用別名。為什麼不使用/var/www/php5.external
在Action
?
答案1
http://httpd.apache.org/docs/2.2/handler.html
http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html
<VirtualHost 1.2.3.4:80>
ServerName domain.tld
ServerAlias www.domain.tld
<IfModule mod_fastcgi.c>
## http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiExternalServer
FastCgiExternalServer /tmp/fpm-domain -idle-timeout 7200 -host 127.0.0.1:9000
## http://httpd.apache.org/docs/2.2/mod/mod_alias.html#alias
Alias /tmp/fpm-engine /tmp/fpm-domain
## http://httpd.apache.org/docs/2.2/mod/core.html#filesmatch
<FilesMatch \.php$>
## http://httpd.apache.org/docs/2.2/mod/core.html#sethandler
SetHandler php-fpm
</FilesMatch>
## http://httpd.apache.org/docs/2.2/mod/mod_actions.html#action
Action php-fpm /tmp/fpm-engine
</IfModule>
DocumentRoot /var/www/domain/web
<Directory /var/www/domain/web>
## http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride
AllowOverride All
</Directory>
</VirtualHost>