apache httpd配置多个端口

 

apache配置多个http端口方法:

1,进入/usr/local/apache/conf/目录下 
2,打开httpd.conf 
3,方法1:

ServerName localhost:80
Listen 80
Listen 81

并将#Include conf/extra/httpd-vhosts.conf,这句中的#去掉 
4,进入extra 打开httpd-vhosts.conf文件 
5,配置如下 
NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/home/public/test"
    ServerName localhost:80
    ServerAlias localhost:80
    ErrorLog "logs/dummy-host.example.com-error_log"
   #CustomLog "logs/dummy-host.example.com-access_log common"
</VirtualHost>

<VirtualHost *:81>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "/home/public/test1"
    ServerName localhost:81
    ErrorLog "logs/dummy-host2.example.com-error_log"
   #CustomLog "logs/dummy-host2.example.com-access_log common"
</VirtualHost> 

方法2: 
或者是,修改httpd.conf文件,增加

Listen   82
Listen   83

并在文件的最后增加如下:

<VirtualHost *:82>
DocumentRoot /home/public/test2
ServerName localhost:82
</VirtualHost>

<Directory /home/public/test2>
 Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

<VirtualHost *:83>
DocumentRoot /home/public/test3
ServerName localhost:83
</VirtualHost>

<Directory /home/public/test3>
 Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/shineniefei/article/details/76691481

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值