Last active
June 25, 2021 08:41
-
-
Save icereed/4e13137a0e2fe9bd9ba2698e55c2243a to your computer and use it in GitHub Desktop.
Dynamic HTTPS + HTTP forwarder for NGINX
This file contains 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.2" | |
services: | |
web: | |
image: nginx | |
volumes: | |
- ./nginx.conf:/etc/nginx/nginx.conf:ro | |
ports: | |
- "80:80" | |
- "443:443" | |
restart: always |
This file contains 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 auto; | |
#error_log /var/log/nginx/error.log; | |
pid /run/nginx.pid; | |
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. | |
include /usr/share/nginx/modules/*.conf; | |
events { | |
worker_connections 1024; | |
} | |
stream { | |
map $ssl_preread_server_name $backend { | |
default $ssl_preread_server_name:443; | |
} | |
server { | |
listen 443; | |
resolver 10.60.16.23; | |
proxy_pass $backend; | |
ssl_preread on; | |
} | |
} | |
http { | |
map $host $backend { | |
default $host:80; | |
} | |
server { | |
listen 80; | |
resolver 10.60.16.23; | |
location / { | |
proxy_pass http://$backend$request_uri; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment