在ubuntu 下 安装apache2完成后

在/etc/apache2/目录下是看不到httpd.conf的

因为被apache2.conf代替了. 不重要 ,只是名字不一样而已

默认情况下 访问127.0.0.1 是读取sites-available的conf配置的

为了支持 多歌虚拟主机的配置我们需要做以下操作

1.在apache2目录下 手动添加 extra 文件夹 ,并在extra文件加下添加一个 httpd-vhost.conf文件

2.打开apache2.conf 对

(1).修改

<Directory />
Options FollowSymLinks
AllowOverride None
#Require all denied //注释掉
allow from all //添加这个选项
</Directory>


(2).添加 Include extra/httpd-vhost.conf



3.在httpd-vhost.conf中 添加虚拟主机 示例:


<VirtualHost *:80>
ServerName localhost.fis3
DocumentRoot /home/spademan/mypro/fis/fis3/
ErrorLog /logs/localhost.fis3-error.log
CustomLog /logs/localhost.fis3-access.log combined
</VirtualHost>


4.重启服务器 sudo apache apache2ctl restart //或者 sudo apachectl restart