Apache:虚拟主机和 mod_fastcgi——它如何工作?

Apache:虚拟主机和 mod_fastcgi——它如何工作?

我读本文使用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.externalin 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>

相关内容