NGINX won´t start on boot

What type of hardware are you using: Other(?)
What YunoHost version are you running: 12.1.39
How are you able to access your server: SSH
Are you in a special context or did you perform specific tweaking on your YunoHost instance ?: I did disable some services sith systemctl

Describe your issue

nginx won’t start on boot but it will start with no problem if I
systemctl start nginx

Share relevant logs or error messages

sudo systemctl status nginx

× nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Fri 2026-05-15 10:12:47 -04; 1min 17s ago
       Docs: man:nginx(8)
    Process: 1088 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
        CPU: 149ms
May 15 10:12:46 eticadigital.eu systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server...
May 15 10:12:47 eticadigital.eu nginx[1088]: 2026/05/15 10:12:46 [warn] 1088#1088: duplicate extension "wasm", content type: "application/wasm", previous content type: "application/wasm" in /etc/nginx/conf.d/nextcloud.eticadigital.eu.d/nextcloud.conf:9
May 15 10:12:47 eticadigital.eu nginx[1088]: 2026/05/15 10:12:46 [warn] 1088#1088: duplicate extension "wasm", content type: "application/wasm", previous content type: "application/wasm" in /etc/nginx/conf.d/ref.eticadigital.eu.d/nextcloud__2.conf:9
May 15 10:12:47 eticadigital.eu nginx[1088]: 2026/05/15 10:12:46 [emerg] 1088#1088: host not found in upstream "ap.ghost.org" in /etc/nginx/conf.d/jandra.eticadigital.eu.d/ghost.conf:11
May 15 10:12:47 eticadigital.eu nginx[1088]: nginx: configuration file /etc/nginx/nginx.conf test failed
May 15 10:12:47 eticadigital.eu systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
May 15 10:12:47 eticadigital.eu systemd[1]: nginx.service: Failed with result 'exit-code'.
May 15 10:12:47 eticadigital.eu systemd[1]: Failed to start nginx.service - A high performance web server and a reverse proxy server.

Might be related to this error.
Can you check this conf file : /etc/nginx/conf.d/jandra.eticadigital.eu.d/ghost.conf?

Can you return the output of dig ap.ghost.org ?

thanks!

here it goes:

I guess I should change http://127.0.0.1to my fixed IP?

My server is at home on CGNAT connection so I have a wireguard tunnel to a VPS in order to have a fixed IP and forward ports. (the details are documented (in spanish) here: Cómo tener un Servidor en Casa sin limitaciones | La Wiki de Ética Digital)

/etc/nginx/conf.d/jandra.eticadigital.eu.d/ghost.conf


#sub_path_only rewrite ^/$ / permanent;
location  / {
proxy_pass http://127.0.0.1:45668;
include proxy_params_no_auth;
client_max_body_size 100M;
}

location ~ ^/.ghost/activitypub/ {
proxy_set_header X-Content-Type-Options nosniff;
proxy_ssl_server_name on;
proxy_pass https://ap.ghost.org;
include proxy_params_no_auth;
}

location ~ ^/.well-known/(webfinger|nodeinfo)$ {
proxy_set_header X-Content-Type-Options nosniff;
proxy_ssl_server_name on;
proxy_pass https://ap.ghost.org;
include proxy_params_no_auth;
}

dig ap.ghost.org

; <<>> DiG 9.18.47-1~deb12u1-Debian <<>> ``ap.ghost.org``
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56732
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;``ap.ghost.org``. IN A

;; ANSWER SECTION:
ap.ghost.org``. 30 IN A 34.49.225.86

;; Query time: 212 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Fri May 15 12:00:41 -04 2026
;; MSG SIZE rcvd: 57

Well… Nothing weird in the config: it’s the default one. The query time is a bit long…
Had you already encountered this issue before installing ghost?

1 Like

nope. It presented itself after installing ghost.

Probably nginx should be started after dnsmasq

1 Like

@jarod5001 I was reading this : Nginx: Everything about proxy_pass - DEV Community
and wondering if @geoma could test this in /etc/nginx/conf.d/jandra.eticadigital.eu.d/ghost.conf

#sub_path_only rewrite ^/$ / permanent;

resolver 127.0.0.1 valid=300s;
set $ghost_url https://ap.ghost.org;

location  / {
proxy_pass http://127.0.0.1:45668;
include proxy_params_no_auth;
client_max_body_size 100M;
}

location ~ ^/\.ghost/activitypub/ {
    proxy_set_header X-Content-Type-Options nosniff;
    proxy_ssl_server_name on;
    proxy_pass $ghost_url  
    include proxy_params_no_auth;
}

location ~ ^/\.well-known/(webfinger|nodeinfo)$ {
    proxy_set_header X-Content-Type-Options nosniff;
    proxy_ssl_server_name on;
    proxy_pass $ghost_url  
    include proxy_params_no_auth;
}
2 Likes

it gives me:

invalid number of arguments in "proxy_pass" directive in /etc/nginx/conf.d/jandra.eticadigital.eu.d/ghost.conf:16

now, if I change the invocation of the variable $ghost_url directly to https://ap.ghost.org``;, it gives the same error as before:

host not found in upstream "``ap.ghost.org``" in /etc/nginx/conf.d/jandra.eticadigital.eu.d/ghost.conf:11

but the thing is that I think you just missed the ; after invoking the variable $ghost_url

so the conf file /etc/nginx/conf.d/jandra.eticadigital.eu.d/ghost.conf should be



#sub_path_only rewrite ^/$ / permanent;

resolver 127.0.0.1 valid=300s;
set $ghost_url “https://ap.ghost.org”;

location  / {
proxy_pass http://127.0.0.1:45668;
include proxy_params_no_auth;
client_max_body_size 100M;
}

location ~ ^/.ghost/activitypub/ {
proxy_set_header X-Content-Type-Options nosniff;
proxy_ssl_server_name on;
proxy_pass $ghost_url;
include proxy_params_no_auth;
}

location ~ ^/.well-known/(webfinger|nodeinfo)$ {
proxy_set_header X-Content-Type-Options nosniff;
proxy_ssl_server_name on;
proxy_pass $ghost_url;
include proxy_params_no_auth;
}

and now it works!! thanks @otm33 !!

So what exactly did we do?

1 Like

headdesk…
It was obvious…
Now, to start, nginx no longer waits for ap.ghost.org to be resolved.

3 Likes

now, when I updated ghost, the config file /etc/nginx/conf.d/jandra.eticadigital.eu.d/ghost.conf went back to the original and the problem presented again

That’s the expected behaviour when upgrading : the default nginx conf is applied.

Try adding 34.49.225.86 ap.ghost.org to /etc/hosts
(that’s the ip address of ap.ghost.org I got pinging it, you can check)