配置虚拟主机文件
一、在 \wamp\bin\apache\Apache2.4.4\conf\extra\httpd-vhosts.conf 文件中按如下内容进行修改:
具体配置代码如下:
NameVirtualHost *:80
DocumentRoot "E:/website/pxsj"
ServerName host7.com
ServerAlias 192.168.1.116
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
NameVirtualHost *:8080
DocumentRoot "E:/website/whsj"
ServerName host10.com:8080
ServerAlias 192.168.1.116:8080
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
二、对 \wamp\bin\apache\Apache2.4.4\conf\httpd.conf 文件进行以下修改:
在该配置文件中搜索 “Listen” 关键字并进行相应调整
相关配置代码如下:
Listen 80
Listen 8080
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf 去掉前面的 # 注释符号,以此启用 httpd-vhosts 虚拟主机配置文件。完成上述步骤后重启服务环境
三、修改 C:\Windows\System32\drivers\etc\hosts 文件中的配置项
配置代码如下: