Windows下Apache 多站點配置與虛擬域名
阿新 • • 發佈:2018-12-08
修改httpd-vhosts.conf配置檔案
<VirtualHost *:80> ServerName localhost ServerAlias localhost DocumentRoot "${INSTALL_DIR}/www" <Directory "${INSTALL_DIR}/www/"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory> </VirtualHost>
在下方新增站點資訊
<VirtualHost *:80> DocumentRoot "${INSTALL_DIR}/www/duo/" ServerName www.duo.com <Directory "${INSTALL_DIR}/www/duo"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory> </VirtualHost>
修改:ServerName 為域名
DocumentRoot 與Directory 為專案位置
配置虛擬域名
修改hosts檔案,新增虛擬域名->C:\Windows\System32\drivers\etc\hosts
在hosts檔案最下面新增你的地址和對應的虛擬域名
比如:127.0.0.1 www.test.com