I am on Ubuntu 18.10, running under vmware and unable to start the nginx service - I get the error "nginx.service: Can't open PID file /run/nginx".
I have compiled nginx from source using passenger. It went ok on one machine, but trying it in my vm I cannot start the nginx service. It gives the above error as it cannot open the PID file (or create it?). I have done systemctl enable & start and it hangs.
I have used the /etc/sytemd/system/nginx.service script as follows:
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
I have tried substituting /var/run for /run and it gives the same error.
There is no reference to the PID in the nginx.conf (and I don't think there needs to be?).
Could anyone give me any pointers on how to troubleshoot or fix this please?