zl2003cn
zl2003cn

Reputation: 485

listen on port 80 but can't access from public using nginx on centos 7.1

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      16146/nginx: master

nginx did listen to port 80. Here is my config in /etc/nginx/conf.d/default.conf

server {
    listen       80;
    server_name  _;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ { ...

I'm running nginx on cloud host with a public ip, but I can't access that ip from public network because connection timeout.

Upvotes: 0

Views: 3372

Answers (1)

Andy Milga
Andy Milga

Reputation: 78

First: Use tcpdump to check if u trying to connect server u need.
at dest server:
tcpdump -i your_wan_if port 80 (Ex: tcpdump -i venet0 port 80)
at local host:
telnet external_ip 80
if u will see any activity from ur ip - nice.

Second:
check selinux and firewall. try to disable them for few moments and check.

(if u know how to configure iptables - do it. Dont know - use google. Dont want google - use this: iptables -I INPUT 4 -p tcp --dport 80 -j ACCEPT)

Upvotes: 2

Related Questions