英文:
nginx configuration for ec2
问题
请使用"Public IPv4 address"在您的服务器块中。您的服务器块应如下所示:
server {
listen 公共IPv4地址:80 default_server;
这样配置后,您的应用将能够在EC2实例上本地运行,并能够响应来自外部计算机的请求。
英文:
I have an app on nginx which works fine when I run things locally via curl but does not seem to like it when i try it from an external computer.
On EC2 console I see three different types of ip addresses:
Public IPv4 address, Private IPv4 addresses, Public IPv4 DNS
which one should be on the server block? My server block looks like so:
server {
listen xx-xx-xx-xxx:80 default_server;
When I use the following on nginx server block, I have the following:
private IP address: app works locally on ec2 (responds correctly to curl requests) but does not respond on external requests (curl)
public IP address: nginx fails with:
May 11 08:55:59 ip-xx-xx-xx-xxx nginx[1936]: nginx: [emerg] bind() to xx-xx-xx-xxx:80 failed (99: Cannot assign requested address)
Public IPv4 DNS: app works locally (curl responds correctly), but does not work externally
WTF should I be using on the server block. so confusing!
答案1
得分: 0
你应该使用公共IP地址,并确保80端口是否被允许。
英文:
You should use public IP address and have to make sure that whether 80 port is allowed or not
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论