![Apache:虚拟主机和 mod_fastcgi——它如何工作?](https://linux22.com/image/660793/Apache%EF%BC%9A%E8%99%9A%E6%8B%9F%E4%B8%BB%E6%9C%BA%E5%92%8C%20mod_fastcgi%E2%80%94%E2%80%94%E5%AE%83%E5%A6%82%E4%BD%95%E5%B7%A5%E4%BD%9C%EF%BC%9F.png)
我读本文使用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
in 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>