zoukankan      html  css  js  c++  java
  • nginx 在linux下端口被禁用问题

     

    摘要:

    ginx部署的时候主要在两种情况下会出现被禁用的情况:


    跟selinux或者是firewall有关系

     

     

     

    情况1:
    nginx: [emerg] bind() to 0.0.0.0:7990 failed (13: permission denied)
    这种情况是由于selinux的policy的原因被禁用的。
    采用semanage工具就可以处理。

    这里补充一下:当我们知道工具名称的时候,如何通过yum来查找其存在哪个包里。

    如何找到某个命令在哪个安装包?

    #yum provides /usr/sbin/semanage

    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    * base: mirrors.aliyun.com
    * epel: fedora.cs.nctu.edu.tw
    * extras: mirrors.aliyun.com
    * updates: mirrors.aliyun.com
    policycoreutils-python-2.5-33.el7.x86_64 : SELinux policy core python utilities
    Repo : base
    Matched from:
    Filename : /usr/sbin/semanage


    根据上面查询包是: policycoreutils-python
    因此,安装工具

    yum install policycoreutils-python

    查找http port selinx的policy阻止的

    #semanage port -l | grep http_port_t
    http_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000

    增加端口:

    sudo semanage port -a -t http_port_t -p tcp 7990

    有点类似centos7的firewall

    第二种情况就是firewall阻止了端口

     


    查看端口:

    firewall-cmd --list-ports

    增加端口:
    firewall-cmd --add-port=7990/tcp --zone=public --permanent

    firewall-cmd --reload

  • 相关阅读:
    jdk动态代理
    mysql-索引方案
    闭包的有点以及出现的内存泄露2016/4/12
    表单2016/4/8
    cursor
    同一个事件绑定不同的函数
    a:link visited hover active
    对于属性操作,加入属性,移除属性
    offset获取位置
    清除浮动6中方法
  • 原文地址:https://www.cnblogs.com/king_astar/p/12247872.html
Copyright © 2011-2022 走看看