1、打开httpd.conf,查找Listen:80,在下面一行加入Listen:8080;
2、查找#Include conf/extra/httpd-vhosts.conf,将此行前面的#去掉;
3、打开httpd.conf文件目录下面的extra文件夹下面的httpd-vhosts.conf文件;
4、查找NameVirtualHost *:80,在下面一行增加NameVirtualHost *:8080;
5、复制httpd-vhosts.conf文件最下面的如下代码,并且在下面粘贴一份:
代码如下:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.abc.com
DocumentRoot "G:/PHP"
ServerName dummy-host.abc.com
ServerAlias www.dummy-host.abc.ccom
ErrorLog "logs/dummy-host.abc.com-error.log"
CustomLog "logs/dummy-host.abc.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.abc.com
DocumentRoot "G:/PHP"
ServerName dummy-host2.abc.com
ErrorLog "logs/dummy-host2.abc.com-error.log"
CustomLog "logs/dummy-host2.abc.com-access.log" common
</VirtualHost>
6、将上面代码修改为:
代码如下:
<VirtualHost *:8080>
ServerAdmin webmaster@dummy-host.abc.com
DocumentRoot "G:/PHP/abc"
ServerName dummy-host.abc.com
ServerAlias www.dummy-host.abc.ccom
ErrorLog "logs/dummy-host.abc.com-error.log"
CustomLog "logs/dummy-host.abc.com-access.log" common
</VirtualHost>
<VirtualHost *:8080>
ServerAdmin webmaster@dummy-host2.abc.com
DocumentRoot "G:/PHP/abc"
ServerName dummy-host2.abc.com
ErrorLog "logs/dummy-host2.abc.com-error.log"
CustomLog "logs/dummy-host2.abc.com-access.log" common
</VirtualHost>
7、保存并重启apache。
备注:
1、以上代码主要是修改了端口和目录,80端口对应的目录为G:/PHP,8080端口对应的目录为G:/PHP/abc;
新闻热点
疑难解答