注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

断尘居

温柔的男人像海洋。

 
 
 
 
 

日志

 
 

Linux下修改httpd端口报错 | Alter httpd port on Linux  

2014-11-03 14:32:42|  分类: Nginx/Apache |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

 # 软件环境丨Software Environments

  • OS:Centos 6.5
  • Server:Apache 2.2

# 问题描述丨Problem Description

     由于服务器80端口已经被gitlab自带的Nginx占用,故尝试编辑Apache配置文

> vim /etc/httpd/conf/httd.conf,并将其端口修改为88,然后重启服务但是却出现如下错误:

     Because of the default port 80 is already defined by Nginx, so I tried to edit the configuration file of Apache > vim /etc/httpd/conf/httpd.conf, and changed it to 88, then restart the service but it gave me the error message below:

[root@BobServerStation ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: (13)Permission denied: make_sock: could not bind to address [::]:88
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:88
no listening sockets available, shutting down
Unable to open logs
                                                            [FAILED]

 # 解决方案丨The Solution(s)

通过Google得知是由于SELinux策略问题,现总结有两种解决方案:

I learnt that it was caused by the SELinux via searching Google, and here are two solutions to sum up.

  • 关闭SELinux策略(不建议)| Disable SELinux policy(Not recommended)
    > vim /etc/sysconfig/selinux

    # This file controls the state of SELinux on the system.
    #     SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=enforcing

    将enforcing改为disabled,然后> reboot

    change the value to disabled, and then > reboot.

  • 向SELinux添加指定端口(建议) | add the specified port to SELinux (Recommended)
    默认情况下,SELinux策略只识别已被关联的服务,如果想让Apache监听自定义端口,我们可以用semanage命令来添加相应规则。

    By default, the SELinux policy will only allow services access to recognized ports associated with those services, if we want to allow Apache to listen on TCP port 88, we can add a rule by using the semanage command.

    > semanage port -a -t http_port_t -p tcp 88

    At the end, restart Apache service, all will be OK. 

    > service httpd restart


 # 参考资料丨Reference


</END>
{
    “Author" : "Bob.Z",
    "E-mail" : "zhaohevip#gmail.com",
    "CreateDate" : "2014-11-03",
    "LastModified" : "2014-11-03",
    "Comment" : "断尘居 All Rights Reserved"
}
  评论这张
 
阅读(598)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017