CentOS   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了centos – nginx配置 – 可从外部localhost访问大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我在我的nginx.conf中有这个 server { listen 80; server_name localhost; root /opt/myapp/PUBLIC; passenger_enabled on; } 问题是我可以从运行它的计算机访问webapp,但不能从网络中的任何其他计算机访问.有任何想法吗? 在CentOS 5.6上运行 ‘s
我在我的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

大佬总结

以上是大佬教程为你收集整理的centos – nginx配置 – 可从外部localhost访问全部内容,希望文章能够帮你解决centos – nginx配置 – 可从外部localhost访问所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。