0

我通过 Docker(在端口 10001 上)使用 Tileserver-GL,并通过 NGINX 的反向代理传递它。我让它工作,这样我就可以在a.cube-kokomo.com访问 tileserver-GL 的主页,但是页面上的所有链接都给我一个 404 错误。我正在使用 CertBot 来管理 SSL 证书。我的目标是能够通过安全网站 (HTTPS) 提供磁贴。

server {
       root /var/www/a.cube-kokomo.com/html;
       index index.html index.htm index.nginx-debian.html
       
       server_name a.cube-kokomo.com;


       location / {
       proxy_set_header X-Forwarded-Host $host;
       proxy_set_header X-Real_IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header Host $http_host;
       proxy_pass http://localhost:10001;
              try_files $uri $uri/ =404;
       }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrupt/live/a.cube-kokomo.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsendcript/live/a.cube-kokomo.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot



}
server {
    if ($host = a.cube-kokomo.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
4

1 回答 1

0

我找到了解决方案。在第 14 行下方:

proxy_pass http://localhost:10001;

我写过

try_files $uri $uri/ =404;

删除这条线立即解决了我的问题。

于 2021-05-28T16:22:35.090 回答