Last active
November 20, 2023 11:14
-
-
Save namhikelo/3f465d6cff434a21a4f57c188994374f to your computer and use it in GitHub Desktop.
Config SSL for event CTFd
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 4; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
# Configuration containing list of application servers | |
upstream app_servers { | |
server ctfd:8000; | |
} | |
server { | |
listen 443 ssl default_server; | |
server_name _; | |
ssl_certificate /path | |
ssl_certificate_key /path | |
return 412; | |
} | |
server { | |
listen 443 ssl; | |
server_name [ten event]; | |
ssl_certificate /path | |
ssl_certificate_key /path | |
gzip on; | |
client_max_body_size 4G; | |
# Handle Server Sent Events for Notifications | |
location /events { | |
proxy_pass http://app_servers; | |
proxy_set_header Connection ''; | |
proxy_http_version 1.1; | |
chunked_transfer_encoding off; | |
proxy_buffering off; | |
proxy_cache off; | |
proxy_redirect off; | |
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-Host $server_name; | |
} | |
# Proxy connections to the application servers | |
location / { | |
proxy_pass http://app_servers; | |
proxy_redirect off; | |
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-Host $server_name; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment