基本的nginx proxy_pass失败,HTTP 500

我有一个非常小的configuration,我相信应该反向代理我在example.com:1234上看到example.com[:80]

 error_log /var/log/nginx/error.log info; events{ } http{ server{ listen 80; server_name example.com; location / { proxy_pass http://example.com:1234; proxy_redirect default; } } } 

但是,导航到端口80导致内部服务器错误500 – 导航到端口1234呈现预期的输出。

日志只包含“信号进程开始”条目。

我做错了什么,或错过了? 如何logging服务器错误的更好(任何!)描述; 我预计这不是最后一次有用的。

如果您的后端在同一台主机上,请尝试使用proxy_pass http://127.0.01:1234; 而不是proxy_pass http://example.com:1234; 。 NGINX在使用DNS之前调用内部名称parsing逻辑,因为你的server_nameproxy_pass指令中的主机名相同,这可能是你的问题的根源。