apache 虚拟主机设置
1.打开apache配置文件apache/conf/httpd.conf(不知道apache在哪的请自行查看phpinfo()中的"Server Root" ...)
首先查找Listen 80
Listen 80 // 默认只有一行这个 可以添加多行端口让apache监听如下
Listen 8081
Listen 8082
Listen 8083
再查找# Virtual hosts
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf // 把这行默认的#去掉即开启Virtual hosts
2.修改apache/conf/extra/httpd-vhosts.conf
末尾添加如下,前面监听了几个端口,后面就添加几个。
1 <VirtualHost *:8081>
2 ServerAdmin webmaster@dummy-host.com
3 DocumentRoot "E:/root/thisway" //8081端口网站地址
4 ServerName thisway
5 ServerAlias www.thisway.ls
6 ErrorLog "logs/thisway.log" // 日志文件
7 CustomLog "logs/thisway.log" common // 日志文件
8 <Directory "E:/root/thisway"> // 8081端口网站地址
9 Options Indexes FollowSymLinks
10 AllowOverride ALL
11 Order allow,deny
12 Allow from all
13 </Directory>
14 </VirtualHost>
3.重启apache服务,访问localhost:8081即可。
-------------------------------
All or nothing, now or never.
All or nothing, now or never.