Nginx 在本地网络中不起作用

标签 nginx centos localhost

操作系统 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 的问题。您是否在 Nginx 访问或错误日志中看到任何访问尝试?如果这是 Nginx 问题,您应该这样做。

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

尝试使用 nmap端口扫描自己并确认检测到在端口 80 上运行的东西:

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

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

关于Nginx 在本地网络中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11882569/

相关文章:

networking - 为什么 nginx 在加载资源时会从平均服务器返回 404?

linux - 使用 mono 在 Centos 中部署 ASP.net

python - Asterisk AGI 文件返回 ImportError

java - 如何授予对 localhost :8080 on network? 的访问权限

vue.js - 如何在本地主机中使用 HTTPS 运行 NUXT (npm run dev)?

ruby-on-rails - 服务器发送的事件和 Rails Streaming

mysql - docker 容器的用户权限会影响主机对 docker-compose.yml 中已安装卷的权限吗?

mysql - 超出 MariaDB/MySQL 资源限制

linux - 如何在本地机器上解析域名

python - CreateProcessW 失败错误 :2 ssh_askpass: posix_spawn: No such file or directory Host key verification failed, 远程服务器上的 jupyter notebook