如何在WampServer中Apache配置虚拟主机方法

2024-10-15 03:23:26

1、Host文件是用于DNS解析,本地的host文件优于网络上的DNS解析。找到目录C:\Windows\System32\drivers\etc下的host文件,用记事本打开在后面添加一行 127.0.0.1 www.test.com。

如何在WampServer中Apache配置虚拟主机方法

4、找到Apach下的httpd-vhosts.conf 一般是在apach安装目录下的conf目录下(如:C:\wamp64\bin\apache\apache2.4.23\conf\extra)

5、在httpd-vhosts.conf文件里添加如下代码<VirtualHost *:80> #网站根目录 Document伊怕锱鳏Root "F:/test" #域名 ServerName www.test.com #这里配置欢迎首页面 DirectoryIndex index.html index.htm index.php <Directory /> Options FollowSymLinks #不允许别人修改我们的页面 AllowOverride None #设置访问权限 order allow,deny Allow from all </Directory> </VirtualHost>

如何在WampServer中Apache配置虚拟主机方法

7、在浏览器输入自己设置的域名,出现如下说明设置成功。

如何在WampServer中Apache配置虚拟主机方法

9、找到下面的代码<Dire罕铞泱殳ctory /> AllowOverride none Requ足毂忍珩ire all denied</Directory>将它改为:<Directory /> AllowOverride none Require all granted</Directory>就可以了

如何在WampServer中Apache配置虚拟主机方法
猜你喜欢