1.配置Apache文件httpd.conf
打開xampp安裝目錄下的Apache-》conf文件夾下的httpd.conf,用記事本打開
首先在Listen 80端口下添加其他監(jiān)聽端口:
Listen 8001Listen 8002Listen 8003
然后在httpd.conf最后加入:
NameVirtualHost *:8001<VirtualHost *:8001>ServerName localhost:8001DocumentRoot "D:\Program Files\xampp\htdocs1"</VirtualHost>NameVirtualHost *:8002<VirtualHost *:8002>ServerName localhost:8002DocumentRoot "D:\Program Files\xampp\htdocs2"</VirtualHost>NameVirtualHost *:8003<VirtualHost *:8003>ServerName localhost:8003DocumentRoot "D:\Program Files\xampp\htdocs3"</VirtualHost>
然后修改如下地方:
改為:
<Directory /> #AllowOverride none #Require all denied AllowOverride all Order deny,allow Allow from all</Directory>
2.打開Windows對應(yīng)的端口:8001,8002,8003
控制面板->Windows防火墻->高級設(shè)置->出站規(guī)則->新建規(guī)則,將相應(yīng)的端口添加進(jìn)去
3.新建網(wǎng)站對應(yīng)的目錄文件夾
4.重啟Apache服務(wù)器
6.訪問localhost:8001/XXX/XXX,查看結(jié)果