apache伺服器多埠支援

魔豆發表於2016-03-23

本示例支援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>

相關文章