在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
5.配置hosts,即可用虚拟域名访问