centos – nginx配置 – 可从外部localhost访问

前端之家收集整理的这篇文章主要介绍了centos – nginx配置 – 可从外部localhost访问前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我在我的Nginx.conf中有这个

server {
      listen 80;
      server_name localhost;
      root /opt/myapp/public;
      passenger_enabled on;
}

问题是我可以从运行它的计算机访问webapp,但不能从网络中的任何其他计算机访问.有任何想法吗?

在CentOS 5.6上运行

最佳答案
‘server_name localhost’使得Nginx要求Host头为’localhost’,即要求客户端尝试使用’http://localhost‘来访问它,因此只能在localhost本身上工作:-).
要么不输入server_name,要么使用其他主机将识别它的那个(fqdn,IP等).
http://wiki.nginx.org/VirtualHostExample
原文链接:https://www.f2er.com/nginx/435210.html

猜你在找的Nginx相关文章