fumingxia 发表于 2018-11-24 12:51:09

apache 不能修改其他端口

  部署了应用,但是修改apache默认是80端口,又不想用80端口,于是就改其他端口,结果弹出:Permission denied: make_sock: could not bind to address [::]:XX,哥用的是root啊,不应该有权限问题,查了一下才知道是开了selinux保护。
  解决这样的问题有两个方法:
  1.就是停掉selinux,最直接最根本的解决方法,但是会缺少保护
  echo 0 > /etc/selinux/enforce
  2.我用的centos,现在安装工具吧
           # yum install policycoreutils-python
  # semanage port -l | grep http
  查看一下selinux下面允许http作为端口信息
            http_cache_port_t tcp 3128, 8080, 8118, 10001-10010
          http_cache_port_t udp 3130
          http_port_t tcp 80, 443, 488, 8008, 8009, 8443
         pegasus_http_port_t tcp 5988
         pegasus_https_port_t tcp 5989
  # semanage port -a -t http_port_t -p tcp 78
  把端口78 加进去
  # semanage port -l | grep http
           http_cache_port_t tcp 3128, 8080, 8118, 10001-10010
         http_cache_port_t udp 3130
          http_port_ttcp 78, 80, 443, 488, 8008, 8009, 8443
          pegasus_http_port_t tcp      5988
          pegasus_https_port_t tcp      5989
  再重启一下:# /etc/init.d/httpd restart
  ok了。。



页: [1]
查看完整版本: apache 不能修改其他端口