我希望这将是一个相对简单的问题,但我被难住了,搜索潜在的解决方案也没有帮助。
我想在 DigitalOcean 上为我的 Ghost droplet 提供一个静态 (ads.txt) 文件。但是有一个问题,因为它似乎无法通过 https/ssl 访问,而在 http 上却可以访问?
更具体地说,在我的域名 example.com 上,
https://example.com/ads.txt
给出 404,但http://example.com/ads.txt
工作正常
为什么会这样?我该如何解决?
这是我的.conf 文件:
.conf
文件
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
文件
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;
}
我尝试了多种 ssl conf 文件变体,但无济于事。如能得到任何帮助我将不胜感激!