如何在XAMPP下用端口配置多网站

来源:互联网 发布:java替换字符串 编辑:程序博客网 时间:2024/06/08 05:51

1.打开C:\xampp\apache\conf\httpd.conf文件(大约在58行左右),在顶部添加需要被监听的端口:801、802,保留默认监听的 80 端口

Listen 80

Listen 801
Listen 802

2.打开C:\xampp\apache\conf\extra\httpd-vhosts.conf(最后1行)加上

<virtualhost *:801>
    ServerName localhost
    DocumentRoot C:\xampp\htdocs\web1
</virtualhost>

<virtualhost *:802>
    ServerName localhost
    DocumentRoot C:\xampp\htdocs\web2
</virtualhost>

其中web1,web2表示你的两个网站目录

原创粉丝点击