Skip to content

Instantly share code, notes, and snippets.

@matsubo
Created February 11, 2023 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matsubo/735eaf0bde87e8a89e6a55e8980cb03c to your computer and use it in GitHub Desktop.
Save matsubo/735eaf0bde87e8a89e6a55e8980cb03c to your computer and use it in GitHub Desktop.
Build a HTTP3 enabled nginx
version: '3.8'
services:
nginx:
image: nwtgck/nginx-http3
ports:
- '443:443/udp'
restart: always
volumes:
- ./nginx.conf:/usr/local/nginx/conf/nginx.conf
- /etc/letsencrypt/live/train.teraren.com/fullchain.pem:/etc/ssl/certs/server.crt
- /etc/letsencrypt/live/train.teraren.com/privkey.pem:/etc/ssl/private/server.key
- /home/matsu/train:/var/www/html
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
# Enable QUIC and HTTP/3.
listen 443 quic reuseport;
ssl_certificate /etc/ssl/certs/server.crt;
ssl_certificate_key /etc/ssl/private/server.key;
# Enable all TLS versions (TLSv1.3 is required for QUIC).
ssl_protocols TLSv1.3;
access_log /dev/stdout;
error_log /dev/stderr debug;
location / {
proxy_pass http://your-backend-host:3005;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Host $host;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment