监听端口80,但无法从centos 7.1上使用nginx的公共访问 [英] listen on port 80 but can't access from public using nginx on centos 7.1

查看:613
本文介绍了监听端口80,但无法从centos 7.1上使用nginx的公共访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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听了端口80。我的配置在 /etc/nginx/conf.d/default.conf

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$ { ...

我使用公共ip在云主机上运行nginx,但是我无法从公共网络因为连接超时。

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

推荐答案

首先:
使用tcpdump检查u是否尝试连接服务器u需要。 br>
at dest server:

tcpdump -i your_wan_if port 80 (例如: tcpdump -i venet0 port 80
本地主机上的


telnet external_ip 80

如果u会看到任何活动从ur ip - 好。

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.

第二:

检查selinux和防火墙。尝试禁用它们一段时间并检查。

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

(如果你知道如何配置iptables - 不要知道 - 使用google不要google - 使用这个:
iptables -I INPUT 4 -p tcp --dport 80 -j ACCEPT

(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)

这篇关于监听端口80,但无法从centos 7.1上使用nginx的公共访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆