0%

WAMP server 2.4以上开81端口虚拟主机

1、打开httpd.conf: 将#Include conf/extra/httpd-vhosts.conf 前的“#”去掉 让apache加载虚拟机配置文件

2、打开conf/extra/httpd-vhosts.conf,隐掉或删掉例子

1
2
3
4
5
6
7
8
9
10
11
12
13
#<VirtualHost *:80>

# ServerAdmin webmaster@dummy-host2.example.com

# DocumentRoot "/usr/local/apache2/docs/dummy-host2.example.com"

# ServerName dummy-host2.example.com

# ErrorLog "logs/dummy-host2.example.com-error_log"

# CustomLog "logs/dummy-host2.example.com-access_log" common

#</VirtualHost>

3、 #ip指向web可访问目录

1
2
3
4
5
<VirtualHost *:81>
ServerAdmin email@email.com
DocumentRoot "/opt/web/root/"
ServerName 127.0.0.1:81
</VirtualHost>

#域名指向web可访问目录下的某一个项目

1
2
3
4
5
<VirtualHost *:81>
ServerAdmin email@email.com
DocumentRoot "/opt/web/root/test/"
ServerName www.test.com
</VirtualHost>
  1. 打开apache的配置文件httpd.conf
    追加Listen 0.0.0.0:81

即可