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

  • 相关阅读:
    加载页面(Loading)
    js判断手机连接网络类型
    combotree的加载方法
    jquery.util.easyui.dialog
    datagrid后台分页js.js
    安卓使用Canvas绘制工作日程表
    【Oracle】OGG数据初始化之RMAN
    怎样优雅的管理ActionBar
    openwrt undefined reference to ‘getpwent_r’
    通过文件对照工具Merge数据库
  • 原文地址:https://www.cnblogs.com/king_astar/p/12247872.html
Copyright © 2011-2022 走看看