apache服务器多端口支持

本示例支持80,82两端口

修改conf/httpd.conf文件:

Listen 80

改为

Listen 80
Listen 82
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

改为

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

修改conf/extra/httpd-vhosts.conf

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
    ErrorLog "logs/error.log"
    CustomLog "logs/access.log" common
</VirtualHost>

<VirtualHost *:82>
    DocumentRoot "D:/web"
    ServerName localhost
    ErrorLog "logs/error.log"
    CustomLog "logs/access.log" common
</VirtualHost>

开启httpd-vhosts.conf配置文件后,xampp会报Access forbidden的错误,需要修改conf/httpd.conf文件:

<Directory />
    AllowOverride none
    Require all denied
</Directory>

改为:

<Directory />
    AllowOverride none
    #Require all denied
    Order deny,allow
    Allow from all
</Directory>
原文地址:https://www.cnblogs.com/modou/p/5310877.html