Failing nginx tests

So this is another weird one for me. While developing a Magento store on a self-setup LEMP stack I found out eventually that some parts of the system weren’t working correctly, and that no logs were being written.
My first guess was that there was something wrong with the filepermissions, I think this has to do with a few Ubuntu upgrades I ran earlier, must’ve reset some things I missed. So I set the Magento folder permissions straight (straightforward enough nowadays), and dove into the nginx troubles.

nginx -t is the first command that got me anywhere, this was it’s response

nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() "/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed

The first time I ran this command, it also outputted that the permission was denied for /var/log/nginx/error.log. That was dealt with earlier. The main issue seems to be the /run/nginx.pid file. Whenever I try to run the same test as sudo, it does pass and there are no permission issues on the .pid file. Fun fact, not sure if this is how it should be.

After sifting through Google results on the matter I learned that it had to do something with the inability to restart the server. So I reset it via Gcloud without any issue, but the problem was the same. So I tried to restart it with the sudo service nginx restart command. It failed, but at this point the server wrote error logs again:

2017/08/24 10:13:18 [warn] 2596#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
2017/08/24 10:13:18 [emerg] 2596#0: open() "/run/nginx.pid" failed (13: Permission denied)
2017/08/24 10:14:28 [emerg] 2655#0: bind() to 0.0.0.0:80 failed (98: Address already in use)

That last one was a hit. It says some (other) process is already using port 80. Using the sudo fuser -k 80/tcp command I killed whatever that was, and tried to restart it again; this time without errors.

Now I still have those two issues (and I guess the logical result of the test failing) left, just like this guy.
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
nginx: [emerg] open() "/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed

But for now this is a secondary issue; the main problem was I wasn’t able to debug the frontend. The logs are being written, I’ll park this one for now.