Created
February 11, 2023 15:46
-
-
Save matsubo/735eaf0bde87e8a89e6a55e8980cb03c to your computer and use it in GitHub Desktop.
Build a HTTP3 enabled nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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