ubuntu apache fastcgi 虚拟主机安装

1 cp /etc/apache2/sites-available/default /etc/apache2/sites-available/www.domain.com

这里www.domain.com就是虚拟主机的配置文件(当然文件名可任意)


2 编辑这个配置文件,在<VirtualHost *:80>后直接加上

                       ServerName www.domain.com

此句说明虚拟主机的域名为www.domain.com;

同时请删除这一行:(笔者使用的是fastcgi模式,若不是此模式,此项操作不一定需要)

           FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 120 -pass-header Authorization

不然重启apache时会报 错,内容 为:

           FastCgiExternalServer: redefinition of previously defined class "/usr/lib/cgi-bin/php5-fcgi" Action 'configtest' failed.


3 接下来启用这个配置文件

       a2ensite www.domain.com


4 重启apache

      service apache2 reload


若重启失败,显示信息为:apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

可修改 /etc/apache2/httpd.conf文件(一般此文件为空),加上如下一句:

          ServerName localhost


再重启就OK了


原文地址:https://www.cnblogs.com/snake-hand/p/3161378.html