方法一:使用httpd-vhosts
(相关推荐:apache)
进入apache配置目录,如/usr/local/apache/conf/
打开httpd.conf文件
配置多个监听窗口81,82
servername localhost:81 # listen 80 listen 81 listen 82
找到#include conf/extra/httpd-vhosts.conf,去掉#号,解除注释
进入/usr/local/apache/conf/extra目录,打开httpd-vhosts.conf文件
配置namevirtualhost *:81
<virtualhost> serveradmin host1.example.com documentroot "/home/public/web/host1" servername localhost:81 serveralias localhost:81 errorlog "logs/host1.example.com-error_log" #customlog "logs/host1.example.com-access_log common" </virtualhost> <virtualhost> serveradmin host2.example.com documentroot "/home/public/web/host2" servername localhost:82 errorlog "logs/host1.example.com-error_log" #customlog "logs/host1.example.com-access_log common" </virtualhost>
方法二:只修改 httpd.conf
进入apache配置目录,如/usr/local/apache/conf/
打开httpd.conf文件
配置多个监听窗口,81,82
listen 81 listen 82
并在文件的最后增加如下内容:
<virtualhost> documentroot /home/public/web/host1 servername localhost:81 </virtualhost><directory> options indexes followsymlinks allowoverride all order allow,deny allow from all </directory><virtualhost> documentroot /home/public/web/host2 servername localhost:82 </virtualhost><directory> options indexes followsymlinks allowoverride all order allow,deny allow from all </directory>
apache不同版本 目录权限设置
1、old使用
order allow,deny allow from all
2、new使用
require all granted
3、new example
#add for www listen 91 <virtualhost> documentroot "d:/ide/www" servername localhost:91 </virtualhost><directory> options indexes followsymlinks allowoverride none require all granted </directory>
以上就是apache配置多个http端口的方法的详细内容,更多请关注代码网其它相关文章!
发表评论