Welcome! Log In Create A New Profile

Advanced

nginx ignoring config file when started via systemd

December 08, 2015 12:36AM
Hi Guys,

Got a somewhat interesting bug with nginx, which is where my config is being ignored by nginx when it's started via systemd.

Here's the config:

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;

location /nodejs/testnodebox {
proxy_pass http://127.0.0.1:7000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

error_page 404 /404.html;
location = /40x.html {
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}

Now, this config works fine on another server, but on this one, when started via systemd, visiting the URL results in the nginx 404 page.

2015/12/08 16:23:16 [error] 64787#0: *1 open() "/usr/share/nginx/html/nodejs/testnodebox" failed (2: No such file or directory), client: <IP>, server: _, request: "GET /nodejs/testnodebox HTTP/1.1", host: "<snip>"

but if I kill nginx via systemctl stop nginx.service and start it manually via sudo nginx (in the /etc/nginx/ directory) it reads the config and proxies requests fine:

<IP> - - [08/Dec/2015:16:34:30 +1100] "GET /nodejs/testnodebox HTTP/1.1" 200 33 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36" "-"

I've tried enabling the debug log and that hasn't shown anything helpful. So I'm somewhat stuck. Any ideas on what might be causing this? Anywhere I should be looking?

Thanks for you help,

Daniel Sage
Subject Author Posted

nginx ignoring config file when started via systemd

theheadsage December 08, 2015 12:36AM

Re: nginx ignoring config file when started via systemd

mex December 08, 2015 01:28AM

Re: nginx ignoring config file when started via systemd

theheadsage December 08, 2015 07:18PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 149
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready