- 1、本文档共6页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
如何更改linux下Apache端口号
如何更改linux下的Apache端口号
一、修改/etc/httpd/conf/httpd.conf文件中的监听端口号
Listen 80
把80修改成需要的号,如8000,即
Listen 8000二、查看SELinux下http相关端口
# semanage port -l|grep httphttp_cache_port_t tcp 3128, 8080, 8118, 10001-10010http_cache_port_t udp 3130http_port_t tcp 80, 443, 488, 8008, 8009, 8443pegasus_http_port_t tcp 5988pegasus_https_port_t tcp 5989
发现8000不在其范围之内,所以需要另外添加,方法如下:
# semanage port -a -t http_port_t -p tcp 8000
再次查看,
# semanage port -l|grep httphttp_cache_port_t tcp 3128, 8080, 8118, 10001-10010http_cache_port_t udp 3130http_port_t tcp 8000, 80, 443, 488, 8008, 8009, 8443pegasus_http_port_t tcp 5988pegasus_https_port_t tcp 5989
三、在防火墙中开放新添加的端口
修改/etc/sysconfig/iptables文件,在文件中添加如一行:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8008 -j ACCEPT
四、重启防火墙和Apache
# service iptables restart
# service httpd restart
五、正常情况下,应该可以通过新端口访问WEB服务了。
注:
1、第二、三、四步骤是在系统已经开启SELinux和防火墙的情况下设置的,如果已经关闭此两个服务,修改端口后直接重启Apache即可;
2、修改的端口号可以是执行#semanage port -l|grep http后,默认已经有的端口,如8443,这样可以省略额外添加SELinux端口操作;
3、第三步操作可以图形界面下完成。
参考资料
1、Permission denied: make_sock: could not bind to address
/2009/07/permission-denied-makesock-could-not.html
不熟悉python、plone、zope,想用apache。80端口已经不在,就征用81端口凑合吧。修改httpd.conf后apachectl start,结果:(13)Permission denied: make_sock: could not bind to address [::]:81(13)Permission denied: make_sock: could not bind to address :81查一下SELinux下http相关端口 semanage port -l|grep http,结果:http_cache_port_t tcp 3128, 8080, 8118, 10001-10010http_cache_port_t udp 3130http_port_t tcp 80, 443, 488, 8008, 8009, 8443pegasus_http_port_t tcp 5988pegasus_https_port_t tcp 5989直接用man semanage最后例子中的一句# Allow Apache to listen on port 81semanage port -a -t http_port_t -p tcp 81然后再apachectl start,OK。使用域名:81能够访问啦。注:semanagesemanage is used to configure certain elements of SELinux policy without requiring modification to or recompilation from policy sources. This includes the mapping from Linux usernames to SELinux user identities (which controls the initial security context assi
您可能关注的文档
最近下载
- 录井资料管理与应用系统 v2--说明书.doc
- 人音版音乐上《我爱你,中国》ppt课件.ppt
- 长春市某行政办公楼暖通空调设计.docx
- Unit 1 People of Achievement 单词练习题-2021-2022学年高中英语人教版(2019)选择性必修第一册(word版)含答案.docx
- 鱼儿多多幼儿园小班语言PPT课件.pptx VIP
- 18G901-1混凝土结构施工钢筋排布规则与构造详图(现浇混凝土框架、剪力墙、梁、板).docx
- 河北建筑工程学院 908工程经济学 2019-2021年考研真题.pdf VIP
- 镀锌钢管质量检验报告.pdf
- 德龙ECAM22.110.SB咖啡机中文说明书.doc
- 少先队介绍PPT模板.pptx VIP
文档评论(0)