【问题标题】:Nginx doesn't work in local networkNginx 在本地网络中不起作用
【发布时间】:2012-08-09 20:00:03
【问题描述】:

操作系统 6.3 Nginx 不能在本地网络中工作,但它可以在 localhost 中工作。由 elinks 测试。

# ps -ef | grep nginx
root      1447     1  0 Aug07 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx     1448  1447  0 Aug07 ?        00:00:00 nginx: worker process

# netstat -napt | grep nginx
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      1447/nginx

# iptables --list
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

# cat /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

【问题讨论】:

    标签: nginx centos localhost


    【解决方案1】:

    听起来这不是 Nginx 的问题。您是否在 Nginx 访问或错误日志中看到任何访问尝试?如果这是 Nginx 问题,您应该这样做。

    您的netstat 输出显示 Nginx 正在运行并侦听所有 IP 上的端口 80。

    尝试使用nmap 对自己进行端口扫描,并确认检测到在端口 80 上运行的内容:

    nmap -vv -P0 (server IP address or DNS)
    

    如果它没有找到任何东西,听起来好像它被其他地方阻止了。与您的网络管理员交谈。

    【讨论】:

    • 感谢您的帮助,这是 iptables 的问题!
    猜你喜欢
    • 2020-03-21
    • 2022-01-10
    • 2013-09-02
    • 2019-01-18
    • 2022-01-19
    • 2021-06-24
    • 2020-11-25
    • 1970-01-01
    • 2022-10-15
    相关资源
    最近更新 更多