0

I hope this is going to be a relatively simple one but I'm stumped and searching through potential solutions haven't helped.

I am looking to serve a static (ads.txt) file for my Ghost droplet on DigitalOcean. But there is a problem, as it doesn't seem to be reachable on https/ssl whereas on http it's fine?

More specifically, on my domain example.com,

https://example.com/ads.txt gives a 404, while http://example.com/ads.txt works just fine

Why would that be, and how do I fix it?

Here are my .conf files:

.conf file

server {
    listen 80;
    listen [::]:80;

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

    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;
        
    }

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

    location /ads.txt {
        alias /var/www/ads.txt;
    }

    client_max_body_size 50m;
}

-ssl.conf file

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

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

    ssl_certificate /etc/letsencrypt/XXX/fullchain.cer;
    ssl_certificate_key /etc/letsencrypt/XXX/XXX.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;
        
    }

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

 
    location /ads.txt {
        alias /var/www/ads.txt;
    }   

    client_max_body_size 50m;
}

I've tried a bunch of variations for the ssl conf file but to no avail. Any help would be much appreciated!

Tim
  • 31,888
  • 7
  • 52
  • 78
  • Sorry if I wasn't clear. Specifically, on my domain example.com, `https://example.com/ads.txt` gives a 404, while `http://example.com/ads.txt` works just fine. Why would that be, and how do I fix it? (Edited due to formatting) – phrasingboom Oct 30 '20 at 05:37
  • Please post the output of `nginx -T`. – Michael Hampton Oct 30 '20 at 05:58

0 Answers0