I am running nginx on a rpi 4. Once installed I can connect to the default http web page. I then edited the default and modified the virtual host entries to include my server.crt and server.key location. I then ran nginx -t with the following errors below. If I change to root and run nginx -t no errors.
2025/02/26 09:54:09 [warn] 24827#24827: 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
I am not an expert. (There are a bunch of smarter people here). However, it sems that nginx is unable to open the /run/nginx.pid file due to a permission denied error.
Check the permissions of the `/run/nginx.pid, maybe chmod 644 /run/nginx.pid
Maybe change the user directive in the nginx configuration file: you can change the user directive in the nginx configuration file (/etc/nginx/nginx.conf ) :
user your_user your_user_group;
more details about your nginx configuration and the specific permissions set on the relevant files and directories could be helpful if this doesn’t work
You will need to run the nginx process with root privileges, as it is required in order to bind to port 80/443. This is a standard linux behavior where only the root user is able to bind to ports 1-1023. It is standard to run NGINX as root, but it is possible to run in a un-privileged manner, you would just need to use a higher port number. You can see more details on how to run in this manner in our unprivileged docker image repo: