Nginx 502 error
See original GitHub issueSorry for the issue spam… This time, I’ve done a decent amount of research and haven’t found any answer. Now that I’ve installed PowerDNS-Admin and everything appears to be running, when I go to powerdns.domain.com, I’m receiving a 502 error. This error is in /var/log/nginx/powerdns-admin.local.error.log:
cat /var/log/nginx/powerdns-admin.local.error.log
2020/02/05 05:31:07 [crit] 2680#2680: *1 connect() to unix:/opt/web/powerdns-admin/powerdns-admin.sock failed (2: No such file or directory) while connecting to upstream, client: 10.9.0.241, server: powerdns.domain.com, request: "GET / HTTP/1.1", upstream: "http://unix:/opt/web/powerdns-admin/powerdns-admin.sock:/", host: "powerdns.domain.com"
I’m assuming this might be because on another guide I had to follow to get even this far, I was told to disable /etc/resolv.conf. After every command, I was receiving an error about not being able to resolve powerdns (hostname of the server). I added it back and set the nameserver back to 127.0.0.1 with option edns0.
cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
### The following lines, Josh entered
127.0.0.1 powerdns.domain.com powerdns
127.0.0.1 pdns.domain.com pdns
Nginx Config:
server {
listen *:80;
# server_name powerdns-admin.example.com www.powerdns-admin.example.com;
server_name powerdns.domain.com www.powerdns.domain.com;
index index.html index.htm index.php;
root /opt/web/powerdns-admin;
access_log /var/log/nginx/powerdns-admin.local.access.log combined;
error_log /var/log/nginx/powerdns-admin.local.error.log;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_redirect off;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;
proxy_buffer_size 8k;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_headers_hash_bucket_size 64;
location ~ ^/static/ {
include /etc/nginx/mime.types;
root /opt/web/powerdns-admin/app;
location ~* \.(jpg|jpeg|png|gif)$ {
expires 365d;
}
location ~* ^.+.(css|js)$ {
expires 7d;
}
}
location / {
proxy_pass http://unix:/opt/web/powerdns-admin/powerdns-admin.sock;
proxy_read_timeout 120;
proxy_connect_timeout 120;
proxy_redirect off;
}
}
Thoughts? I’m finally so close to having this up and running… If it means anything, on my client machine, I modified the hosts file to point to the server’s IP using it’s hostname. I currently don’t have an internal DNS server. Going to the server’s IP address brings up the default Nginx web page.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:13 (1 by maintainers)
@joshbgosh10592 Hi I encountered a similar problem, solved when I put the nginx config and official documentation ( see close to proxy_pass directive )
https://github.com/ngoduykhanh/PowerDNS-Admin/wiki/Running-PowerDNS-Admin-on-Ubuntu-or-Debian
But I encountered another errorPermissionError: [Errno 13] Permission denied: '/opt/web/powerdns-admin/powerdnsadmin/static/.webasset
helped crutch in the form of chmod 777 in the powerdnsadmin folder, maybe who knows the answer why this happens
Hi, I had the same issue in nginx error.log -> “upstream prematurely closed connection while reading response header from upstream”. In the howtoforge - tutorial for installing powerdns-admin there is a step to change permissions on the application root directory to user www-data. And after configure the systemd service there is a step to change the permissions on the sub-directory <root-path>/powerdnsadmin to user: pdns. It’s important to do these steps in the right order, otherwise you’ll get the upstream-error from nginx.