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 [email protected]
    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 [email protected]
    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

猜你喜欢

转载自blog.csdn.net/h330531987/article/details/81482846