Unable to start Nginx server

I’m not able to start/reload my Ngnix server. Here are the error messages I get

nginx.service is not active, cannot reload.

2025/04/02 11:30:29 [warn] 18813#18813: 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
2025/04/02 11:30:29 [emerg] 18813#18813: open() "/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed

Here is my arborhub.conf (nginx.conf)

server {
         listen 192.168.1.253:80;
         server_name arborhub.io 192.168.1.253;

         location / {
                 include proxy_params;
                 proxy_pass http://unix:/home/ubuntu/MyProject/app.sock;
         }
         location /static/ {
                 autoindex on;
                 alias /home/ubuntu/MyProject/static/;
         }
         location /media/ {
                 autoindex on;
                 alias /home/ubuntu/MyProject/media/;
         location /analytics {

         rewrite  /analytics/(.*) /$1 break;

         proxy_pass         http://<sisense-ip>:30845;

         proxy_http_version     1.1;

         proxy_set_header       X-Forwarded-Proto $scheme;
 proxy_set_header   Upgrade $http_upgrade;

         proxy_set_header   Connection "upgrade";

         proxy_set_header   X-Real-IP  $remote_addr;

         proxy_set_header   X-Forwarded-For $remote_addr;

         proxy_set_header       X-Forwarded-Proto $scheme;

         proxy_set_header   Host $host;

         proxy_connect_timeout  36000;

         proxy_send_timeout     36000;

         proxy_read_timeout     36000;

         send_timeout           36000;

   }
   }
}

I’m not sure I did something wrong in my conf file

The error looks like the process is not being started with the correct permissions. Are you using sudo to start the processes with root level privileges? It needs to be run with elevated permissions in order to be able to bind to port 80/443.

Yes, I am using sudo. I assume I have the right Permissions to start Nginx. Is there a specific command I should write?

I’ve got another problem now. So I created my own DNS server via Bind9.

But I’m trying to create an SSL certificate with LetsEncrypt. I get this error when I run sudo certbot --nginx --agree-tos --preferred-challenges http -d domain-name.com

Saving debug log to /var/log/letsencrypt/letsencrypt.log
The requested nginx plugin does not appear to be installed

. This also could explain why I can’t access my app with domain name arborhub.io on another device (client-side).

Since DNS servers can’t access the IPv6 for my server.

This file may be of some help, /etc/bind/arborhub.io

  GNU nano 8.1                                          /etc/bind/arborhub.io                                                   
$TTL 86400
@   IN  SOA ns1.arborhub.io. admin.arborhub.io. (
        2025040102 ; Serial
        3600       ; Refresh
        1800       ; Retry
        1209600    ; Expire
        86400      ; Minimum TTL
)
    IN  NS  ns1.arborhub.io.
    IN  NS  ns2.arborhub.io.
@   IN  AAAA   2600:6c67:107f:faf1:b297:1a4c:9434:d6c9
ns1 IN  AAAA   2600:6c67:107f:faf1:b297:1a4c:9434:d6c9
ns2 IN  AAAA   2600:6c67:107f:faf1:b297:1a4c:9434:d6c9
www IN  AAAA   2600:6c67:107f:faf1:b297:1a4c:9434:d6c9

Basically trying to get my Django/Vuejs project to production but with domain name arborhub.io.

I need to create an SSL cert first though

Or can someonw send me some url links to good resources for this issue?

so it looks like there is a couple issues here. For the letsencrypt side, it is complaining about a module missing, have you verified that all of the necessary modules(python3-certbot-nginx) are installed? For nginx failing to start, its pretty clear that the issue is that it does not have permissions on the /run/nginx.pid file. Does that path exist on the system? Also, is the file you shared the entire nginx.conf file? It looks like it is only showing the server block portion of the config, which would not be a complete nginx configuration. You can find the default nginx.conf in the gitrepo

Thank you for responding to me. So are you suggesting that this is causing a possible conflict between my nginx server and checkmk, since checkmk runs on apache server?

I asked because not only can I not start nginx server but also run checkmk. I’ll try and fix these problems that you mentioned

And no, I didn’t add the complete nginx config. I’ll add it now

Yes, my Nginx path does exist in my system. Regarding the /run/nginx.pid file, do I have to edit it in order to start/run nginx server?

You don’t have to edit the file, but the user nginx runs as needs to be able to create the file. Once you added a complete config, are you able to start nginx?

Yes, I added a complete config. However I’m running into the same issue as before.

I was able to get my nginx server running and get checkmk running too. I also was able to get checkmk to run behind nginx.

However, I’m still having trouble with opening nginx/checkmk on the browser. I created a new post here if you want to start a discussion there.

PS the new post has the edited arborhub.conf file pasted