本文只介绍apache2.4中多端口虚拟目录的配置,apache2.4的编译安装请参考:学习apache2.4的编译安装。
具体操作如下。
1、配置httpd.conf
复制代码 代码示例:
#Listen 0.0.0.0:80
Listen 80
Listen 81
2、开启虚拟站点
复制代码 代码示例:
# Virtual hosts
#
include conf/extra/httpd-vhosts.conf
#修改为
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
3、配置conf/extra/httpd-vhosts.conf
复制代码 代码示例:
<VirtualHost *:81>
ServerAdmin welcome@www.jb200.com
DocumentRoot "/var/wwwroot"
ServerName 81
ErrorLog "logs/jbxue.localhost-error.log"
CustomLog "logs/jbxue.localhost-access.log" common
<Directory "/data/wwwroot">
Options FollowSymLinks
AllowOverride None
require all granted
</Directory>
</VirtualHost>
4、访问站点出现you don't have permission to access / on this server(Apache Server权限访问问题)
修改httpd.conf:
复制代码 代码示例:
<Directory />
AllowOverride none
Require all denied
</Directory>
<Directory />
AllowOverride none
# Require all denied
</Directory>