当前位置: 代码网 > it编程>数据库>Mysql > apache httpd配置多个端口的实现方法

apache httpd配置多个端口的实现方法

2024年07月22日 Mysql 我要评论
方法一:使用httpd-vhosts进入apache配置目录,如/usr/local/apache/conf/打开httpd.conf配置多个监听窗口,81,82servername localhos

方法一:使用httpd-vhosts

进入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 *:81>
    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 *:82>
    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 *:81>
documentroot /home/public/web/host1
servername localhost:81
</virtualhost>

<directory /home/public/web/host1>
 options indexes followsymlinks
allowoverride all
order allow,deny
allow from all
</directory>

<virtualhost *:82>
documentroot /home/public/web/host2
servername localhost:82
</virtualhost>

<directory /home/public/web/host2>
 options indexes followsymlinks
allowoverride all
order allow,deny
allow from all
</directory>

apache不同版本 目录权限设置

old使用

order allow,deny
allow from all

new使用

require all granted

new example

#add for www
listen 91
<virtualhost *:91>
documentroot  "d:/ide/www"
servername localhost:91
</virtualhost>

<directory "d:/ide/www">
    options indexes followsymlinks
    allowoverride none
    require all granted
</directory>

到此这篇关于apache httpd配置多个端口的实现方法的文章就介绍到这了,更多相关apache httpd配置多个端口内容请搜索代码网以前的文章或继续浏览下面的相关文章希望大家以后多多支持代码网!

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com