Switching site url in config to https casue crashing the site

My URL: https://necro.dedfaf.tech

I was trying to fix the searching-problem like [this topic] (Search not working), and I found that my site url in ghost config is http://necro.dedfaf.tech, which casued searching functionality not working in my https version site. (When i aceess my site by http, searching works, plus the site’s icon showing up while https not showing the icon)

However when set the url to https://necro.dedfaf.tech by running ghost config --url https://necro.dedfaf.tech and restart ghost the whole site crashed showing 502 when visiting it.

my Nginx config:

map $status $header_content_type_options {
    204 "";
    default "nosniff";
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name necro.dedfaf.tech;
    root /var/www/ghost/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)

    ssl_certificate /etc/letsencrypt/necro.dedfaf.tech/fullchain.cer;
    ssl_certificate_key /etc/letsencrypt/necro.dedfaf.tech/necro.dedfaf.tech.key;
    include /etc/nginx/snippets/ssl-params.conf;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:2368;

        add_header X-Content-Type-Options $header_content_type_options;
    }

    location ~ /.well-known {
        allow all;
    }

    client_max_body_size 1g;
}

my config.production.json

{
  "url": "http://necro.dedfaf.tech","//switch the url to https crashes the site"
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "127.0.0.1",
      "user": "ghost",
      "password": "ghost",
      "database": "ghost"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/ghost/content"
  }
}

Im using Debian 6.1.124-1, Mariadb Ver 15.1

I have tried to replace proxy_set_header X-Forwarded-Proto $scheme to proxy_set_header X-Forwarded-Proto https like this issue Bug: Setting url: to https in config.js causes a redirect loop · Issue #2796 · TryGhost/Ghost · GitHub but didn’t work for me.

And also why is there a rule that new user cannot use more than 3 links ( ゚∀。)7?, im sorry to post multiple posts to describe it

No worries on multiple posts. It’s all good.

Can you please switch your site back to https and attempt to start Ghost, then check your ghost logs (in ghost-directory/content/logs) to see if there’s anything informative about why Ghost is ‘crashing’? (Or not starting? Or what?)

When you run nginx -t config-file-name, any errors? And the config file is in (or linked in) sites-enabled, right?

thx for your early reply. Ive checked log before but I cant found any suspicious
https___necro_dedfaf_tech_production.error.log is empty
Here is a part of the log in https___necro_dedfaf_tech_production.log that appeared after I ran the ghost restart command:

{"name":"Log","hostname":"Necrophobia","pid":67575,"level":30,"version":"5.107.2","worker":{"resourceLimits":{"maxYoungGenerationSizeMb":20.25,"maxOldGenerationSizeMb":863,"codeRangeSizeMb":0,"stackSizeMb":4},"threadId":1},"msg":"Worker for job \"mentions-email-report\" online","time":"2025-02-10T05:45:10.798Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67575,"level":30,"version":"5.107.2","msg":"Worker for job mentions-email-report sent a message: done","time":"2025-02-10T05:45:10.806Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67575,"level":40,"version":"5.107.2","msg":"Ghost is shutting down","time":"2025-02-10T05:47:52.131Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67575,"level":40,"version":"5.107.2","msg":"Ghost has shut down","time":"2025-02-10T05:47:52.134Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67575,"level":40,"version":"5.107.2","msg":"Your site is now offline","time":"2025-02-10T05:47:52.134Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67575,"level":40,"version":"5.107.2","msg":"Ghost was running for 4 minutes","time":"2025-02-10T05:47:52.135Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Ghost is running in production...","time":"2025-02-10T05:47:53.914Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Your site is now available on https://necro.dedfaf.tech/","time":"2025-02-10T05:47:53.916Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Ctrl+C to shut down","time":"2025-02-10T05:47:53.916Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Ghost server started in 0.533s","time":"2025-02-10T05:47:53.946Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Bootstrap client was closed.","time":"2025-02-10T05:47:54.112Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Database is in a ready state.","time":"2025-02-10T05:47:54.206Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Ghost database ready in 0.801s","time":"2025-02-10T05:47:54.214Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":40,"version":"5.107.2","msg":"Missing mail.from config, falling back to a generated email address. Please update your config file and set a valid from address","time":"2025-02-10T05:47:54.488Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Invalidating assets for regeneration","time":"2025-02-10T05:47:55.307Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Adding offloaded job to the inline job queue","time":"2025-02-10T05:47:55.822Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Scheduling job mentions-email-report at 18 13 * * * *. Next run on: Mon Feb 10 2025 14:13:18 GMT+0800 (China Standard Time)","time":"2025-02-10T05:47:55.837Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Adding offloaded job to the inline job queue","time":"2025-02-10T05:47:56.015Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Scheduling job clean-expired-comped at 54 0 0 * * *. Next run on: Tue Feb 11 2025 00:00:54 GMT+0800 (China Standard Time)","time":"2025-02-10T05:47:56.019Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Adding offloaded job to the inline job queue","time":"2025-02-10T05:47:56.029Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Scheduling job clean-tokens at 20 20 2 * * *. Next run on: Tue Feb 11 2025 02:20:20 GMT+0800 (China Standard Time)","time":"2025-02-10T05:47:56.041Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Ghost booted in 2.662s","time":"2025-02-10T05:47:56.074Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Adding offloaded job to the inline job queue","time":"2025-02-10T05:47:56.096Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Scheduling job update-check at 47 47 23 * * *. Next run on: Mon Feb 10 2025 23:47:47 GMT+0800 (China Standard Time)","time":"2025-02-10T05:47:56.100Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Running milestone emails job on Mon Feb 10 2025 13:47:56 GMT+0800 (China Standard Time)","time":"2025-02-10T05:47:56.111Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Bootstrap client was closed.","time":"2025-02-10T05:47:56.112Z","v":0}
{"name":"Log","hostname":"Necrophobia","pid":67715,"level":30,"version":"5.107.2","msg":"Ghost URL Service Ready in 2.791s","time":"2025-02-10T05:47:56.203Z","v":0}

nginx -t shows ok

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

and necro.dedfaf.tech-ssl.conf (generated by ghost setup ssl) is in sites-enabled of course

nginx access log:

- http -
MYIP - - [10/Feb/2025:14:48:14 +0800] "GET / HTTP/2.0" 200 5733 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
MYIP - - [10/Feb/2025:14:48:14 +0800] "GET /assets/built/screen.css?v=559b2f9833 HTTP/2.0" 200 9575 "https://necro.dedfaf.tech/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
MYIP - - [10/Feb/2025:14:48:14 +0800] "GET /assets/fonts/inter-roman.woff2?v=559b2f9833 HTTP/2.0" 200 37780 "https://necro.dedfaf.tech/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
MYIP - - [10/Feb/2025:14:48:14 +0800] "GET /assets/built/source.js?v=559b2f9833 HTTP/2.0" 200 18427 "https://necro.dedfaf.tech/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
MYIP - - [10/Feb/2025:14:48:14 +0800] "GET /public/cards.min.css?v=559b2f9833 HTTP/2.0" 200 6793 "https://necro.dedfaf.tech/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
MYIP - - [10/Feb/2025:14:48:14 +0800] "GET /public/cards.min.js?v=559b2f9833 HTTP/2.0" 200 1637 "https://necro.dedfaf.tech/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
- From Here I switched to https and give the site a visit -
MYIP - - [10/Feb/2025:14:48:54 +0800] "GET / HTTP/2.0" 502 559 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
MYIP - - [10/Feb/2025:14:48:54 +0800] "GET /favicon.ico HTTP/2.0" 502 559 "https://necro.dedfaf.tech/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"

The problem havent been solved yet. I may try reset my blog at another VPS. Currently any help would be appriciated…