apache not accepting incoming connections from outside of localhost

前端 未结 11 904
逝去的感伤
逝去的感伤 2020-12-04 05:59

I\'ve booted up a CentOS server on rackspace and executed yum install httpd\'d. Then services httpd start. So, just the barebones.

I can ac

相关标签:
11条回答
  • 2020-12-04 06:36

    Disable SELinux

    $ sudo setenforce 0
    
    0 讨论(0)
  • 2020-12-04 06:38

    In case not solved yet. Your iptables say:

    state RELATED,ESTABLISHED

    Which means that it lets pass only connections already established... that's established by you, not by remote machines. Then you can see exceptions to this in the next rules:

    state NEW tcp dpt:ssh
    

    Which counts only for ssh, so you should add a similar rule/line for http, which you can do like this:

    state NEW tcp dpt:80
    

    Which you can do like this:

    sudo iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
    

    (In this case I am choosing to add the new rule in the fourth line)

    Remember that after editing the file you should save it like this:

    sudo /etc/init.d/iptables save
    
    0 讨论(0)
  • 2020-12-04 06:42

    this would work: -- for REDHAT use : cat "/etc/sysconfig/iptables"

    iptables -I  RH-Firewall-1-INPUT -s 192.168.1.3  -p tcp -m tcp --dport 80 -j ACCEPT
    

    followed by

    sudo /etc/init.d/iptables save
    
    0 讨论(0)
  • 2020-12-04 06:45

    Try with below setting in iptables.config table

    iptables -A INPUT -p tcp --dport 80 -j ACCEPT
    

    Run the below command to restart the iptable service

    service iptables restart
    

    change the httpd.config file to

    Listen 192.170.2.1:80
    

    re-start the apache.

    Try now.

    0 讨论(0)
  • 2020-12-04 06:45

    Search for LISTEN directive in the apache config files (httpd.conf, apache2.conf, listen.conf,...) and if you see localhost, or 127.0.0.1, then you need to overwrite with your public ip.

    0 讨论(0)
  • 2020-12-04 06:45

    Try disabling iptables: service iptables stop

    If this works, enable TCP port 80 to your firewall rules: run system-config-selinux from root, and enable TCP port 80 (HTTP) on your firewall.

    0 讨论(0)
提交回复
热议问题