Search code examples
dockernginxtileserver-gl

Secure Tileserver-GL on Ubuntu 20.04


I am using Tileserver-GL through Docker (on port 10001) and passing it through a reverse proxy with NGINX. I have it working so that I can reach the home page of tileserver-GL at a.cube-kokomo.com, but all of the links on the page give me a 404 ERROR. I am using CertBot to manage the SSL certificates. My goal is to be able to serve tiles through a secured website (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

Solution

  • I found the solution. Underneath line 14:

    proxy_pass http://localhost:10001;
    

    I had written

    try_files $uri $uri/ =404;
    

    Removing this line immediately solved my problems.