jplatte / turbo.fish

::<> ⠀ https://turbo.fish/ ⠀ <>::
GNU Affero General Public License v3.0
631 stars 8 forks source link

Question: How to enable HTTPS? #22

Closed kkocdko closed 2 years ago

kkocdko commented 2 years ago

https://turbo.fish/ is using HTTPS, but I have not found any code about https in this repo. I'm quite curious how you achieved it. 😝

The axum provide a example to show how enable tls using axum_server, but it has some conflict to combine into existed project.

jplatte commented 2 years ago

turbo.fish is being served by Nginx reverse-proxying the server application that you can find in this repo. Config looks roughly like this (some things omitted for simplicity):

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

    server_name turbo.fish;
    return 301 https://$host$request_uri;
}

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

    server_name turbo.fish;
    location / {
        proxy_pass http://localhost:8001;
    }

    ssl_certificate /etc/letsencrypt/live/turbo.fish/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/turbo.fish/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
}