打开wamp的安装目录 wamp64inapacheapache2.4.18conf 打开httpd.conf文件
1、修改以下部分 添加Options FollowSymLinks ,注释Require all denied
<Directory />
Options FollowSymLinks
AllowOverride none
#Require all denied
</Directory>
2、在listen部分添加自定义端口好
Listen 0.0.0.0:80
Listen [::0]:80
#自加:Listen 8001
Listen 8011
3、在文件最底部添加对应端口的项目路径:
NameVirtualHost *:8001
<VirtualHost *:8001>
ServerName localhost:8001
DocumentRoot 'D:project20180606p02test'
</VirtualHost>
NameVirtualHost *:8011
<VirtualHost *:8011>
ServerName localhost:8011
DocumentRoot 'D:project20180606p01test'
</VirtualHost>
4、访问(注:保证当前目录下有index.html 文件,否则按文件目录访问):
localhost:8001
localhost:8011
补充 :
如果本地项目被配置到wamp->www目录下 然后在pc端可以访问 而在移动端通过ip访问被墙掉了的话 尝试在httpd.config内 把第四步的代码改成如下代码:
NameVirtualHost *:8001
<VirtualHost *:8001>
ServerName localhost:8001
DocumentRoot 'D:wamp64wwwweb'
<Directory "D:wamp64wwwweb">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Allow From All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:8001>
ServerName localhost:8001
DocumentRoot 'D:wamp64wwwweb'
<Directory "D:wamp64wwwweb">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Allow From All
Require all granted
</Directory>
</VirtualHost>