(1)启用 httpd-vhosts.conf
在 httpd.conf 文件中
# Virtual hosts ,虚拟主机
#Includeconf/extra/httpd-vhosts.conf 中,将该行的#去掉,进行启用。
(2)
apache\conf\extra
httpd-vhosts.conf在该文件最下方进行配置:
<VirtualHost 127.0.0.1:82>
DocumentRoot "E:\eclipse-php-luna-SR1a-win32\workspace"
#这里配置欢迎首页面
DirectoryIndex index.html index.htm index.php
<Directory />
Options FollowSymLinks
#不许可别人修改我们的页面
AllowOverride None
#设置访问权限
Order allow,deny
Allow from all
Require all granted //注意apache2.4版本需要在此添加此句,血泪般的教训
</Directory>
</VirtualHost>
本文详细介绍了如何在Apache服务器上配置虚拟主机,实现多个网站在同一台服务器上独立运行,通过修改httpd-vhosts.conf文件,设置NameVirtualHost和VirtualHost指令,分配不同的域名到指定的文档根目录,并配置访问权限。
1078

被折叠的 条评论
为什么被折叠?



