Applicable to:
- Plesk for Linux
Symptoms
-
Websites show a "502 Bad Gateway" error. The following error message appears in
/var/log/nginx/error.log
:CONFIG_TEXT: [error] 20109#0: *945 no resolver defined to resolve example.com, client: 192.168.0.1, server: , request: "GET / HTTP/1.1", host: "example.com"
-
$host
is used instead of a server IP address forproxy_pass
value underlocation /
in the file/etc/nginx/plesk.conf.d/server.conf
:# grep -B2 7080 /etc/nginx/plesk.conf.d/server.conf | grep -B2 proxy_pass
location / {
proxy_pass http://$host:7080;
Cause
No resolver is specified in the nginx configuration.
Resolution
-
Connect to the Plesk server via SSH.
-
Open the file
/etc/nginx/nginx.conf
in any text editor. In this example, we are using the vi editor:# vi /etc/nginx/nginx.conf
-
Add resolver under the
http
section:CONFIG_TEXT: http {
resolver 127.0.0.1; -
Save the changes and close the file.
-
Restart nginx:
# service nginx restart
Comments
0 comments
Please sign in to leave a comment.