Add docs on how to use Nginx as a HTTPS proxy (#2735)

Co-authored-by: José Valim <jose.valim@dashbit.co>
This commit is contained in:
Hugo Baraúna 2024-08-07 16:22:07 -03:00 committed by GitHub
parent 2b0193078f
commit f9606d7638
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,45 @@
# Nginx over HTTPS
This guide shows you how to use Nginx to serve Livebook over HTTPS.
## Prerequisites
- Nginx installed
- Livebook installed
- Both Livebook and Nginx running on the same machine or within the same network
- SSL certificate and key files
## Nginx configuration
Use the following Nginx config file as a starting point:
```nginx
http {
server {
listen 443 ssl;
server_name your_domain; # e.g., livebook.example.com
ssl_certificate /path/to/your/ssl_certificate.crt; # e.g., /etc/nginx/ssl/livebook.crt
ssl_certificate_key /path/to/your/ssl_certificate.key; # e.g., /etc/nginx/ssl/livebook.key
location / {
proxy_pass http://livebook_ip:livebook_port; # e.g., http://172.20.0.3:8080 (Livebook's default port is 8080)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header 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;
}
}
server {
listen 80;
server_name your_domain; # e.g., livebook.example.com
return 301 https://$host$request_uri;
}
}
events {}
```

View file

@ -248,6 +248,7 @@ defmodule Livebook.MixProject do
"docs/deployment/docker.md",
"docs/deployment/clustering.md",
"docs/deployment/fips.md",
"docs/deployment/nginx_https.md",
"docs/teams/intro_to_teams.md",
"docs/teams/shared_secrets.md",
"docs/teams/shared_file_storages.md",