Apache配置多个监听端口和不同的网站目录的简单方法

一种方法:

1,在httpd.conf 主配置问文件中定义监听端口 Listen 80  Listen 8080

2,在虚拟主机配置文件中添加如下,如下为参考配置:

NameVirtualHost *:80
<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/data/web/"
ServerName 120.25.208.128
ServerAlias www.jxcia.1.com
ErrorLog "logs/linsir.cn-error_log"
CustomLog "logs/linsir.cn-access_log" combined

</VirtualHost>

 

NameVirtualHost *:8080

<VirtualHost *:8080>
DocumentRoot "/data/web2/"
ServerName 120.25.208.128
</VirtualHost>

 第二种方法:

1,主配置文件不需要设置监听端口,否则会提示端口被占用。。。

2,配置文件如下:

Listen 80
<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/data/web/"
ServerName 120.25.208.128
ServerAlias www.jxcia.1.com
ErrorLog "logs/linsir.cn-error_log"
CustomLog "logs/linsir.cn-access_log" combined

</VirtualHost>

Listen 8080

<VirtualHost *:8080>
DocumentRoot "/data/web2/"
ServerName 120.25.208.128
</VirtualHost>

 

posted @ 2016-08-08 23:10  某电商首席日志工程师  阅读(1072)  评论(0编辑  收藏  举报