Last active
June 10, 2022 09:50
-
-
Save NazmusShakib/b7b38b5ccfa3a854e1a7d973443c5654 to your computer and use it in GitHub Desktop.
Docker containers port serve through domains use Nginx-Reverse-Proxy
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
# Reverse-Proxy - mydomain api & admin | |
server { | |
listen 443 ssl; | |
# listen [::]:443 ssl; | |
server_name stage-api-v2.mydomain.com; | |
client_max_body_size 100M; | |
location / { | |
include /etc/nginx/includes/proxy.conf; | |
proxy_pass http://localhost:3330; | |
} | |
ssl_certificate /etc/ssl/stage_v2/__mydomain_com.crt; | |
ssl_certificate_key /etc/ssl/stage_v2/private.key; | |
# ssl_dhparam /etc/ssl/certs/private/dhparam.pem; | |
access_log /var/log/nginx/stage-api-v2.mydomain.com.access.log; | |
error_log /var/log/nginx/stage-api-v2.mydomain.com.error.log; | |
} | |
# Reverse-Proxy - mydomain admin client_app | |
server { | |
listen 443 ssl; | |
# listen [::]:443 ssl; | |
server_name stage-admin-v2.mydomain.com; | |
client_max_body_size 100M; | |
location / { | |
include /etc/nginx/includes/proxy.conf; | |
proxy_pass http://localhost:3331; | |
} | |
ssl_certificate /etc/ssl/stage_v2/__mydomain_com.crt; | |
ssl_certificate_key /etc/ssl/stage_v2/private.key; | |
# ssl_dhparam /etc/ssl/certs/private/dhparam.pem; | |
access_log /var/log/nginx/stage-admin-v2.mydomain.com.access.log; | |
error_log /var/log/nginx/stage-admin-v2.mydomain.com.error.log; | |
} | |
# Proxy-pass - mydomain client app | |
server { | |
listen 443 ssl; | |
# listen [::]:443 ssl; | |
server_name stage-v2.mydomain.com; | |
client_max_body_size 100M; | |
location / { | |
include /etc/nginx/includes/proxy.conf; | |
proxy_pass http://localhost:3332; | |
} | |
ssl_certificate /etc/ssl/stage_v2/__mydomain_com.crt; | |
ssl_certificate_key /etc/ssl/stage_v2/private.key; | |
# ssl_dhparam /etc/ssl/certs/private/dhparam.pem; | |
access_log /var/log/nginx/stage-v2.mydomain.com.access.log; | |
error_log /var/log/nginx/stage-v2.mydomain.com.error.log; | |
} |
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
# rewrite ^/(.*) /$1 break; | |
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; | |
# proxy_buffering off; | |
# proxy_request_buffering off; | |
# proxy_http_version 1.1; | |
# proxy_intercept_errors on; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment