本地Apache配置多个虚拟主机

本地Apache配置多个虚拟主机
1. 编辑C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf,将这一行前面的井号去掉

# Include conf/extra/httpd-vhosts.conf

2. 新建C:\wamp\vhosts\bbs_rr目录。
3. 在Apache的配置文件C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf,添加如下代码:

#蓝贝分享
<VirtualHost *:80>
    DocumentRoot "C:/wamp/vhosts/bbs_rr/"
    ServerName bbs-rr.io
    ErrorLog "logs/bbs_rr-error.log"
    CustomLog "logs/bbs_rr-access.log" common
	<Directory "C:/wamp/vhosts/bbs_rr/">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
    </Directory>
</VirtualHost>

4. 编辑host文件C:\Windows\System32\drivers\etc\hosts,添加如下代码

127.0.0.1 bbs-rr.io

重启Apache。

如果想添加多个虚拟主机,请重复2至4步。

最后交代一下,我使用的集成环境包是wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b.exe

评论
:broken_heart: :confounded: :flushed: :frowning: :grinning: :heart: :kissing_heart: :mask: :pensive: :rage: :relaxed: :scream: :smile: :smirk: :sob: :stuck_out_tongue_closed_eyes: :stuck_out_tongue_winking_eye: :wink: