Last active
September 27, 2024 17:21
-
-
Save unixcharles/949271 to your computer and use it in GitHub Desktop.
nginx config for http/https proxy to localhost:3000
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
#user nobody; | |
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
send_timeout 1800; | |
sendfile on; | |
keepalive_timeout 6500; | |
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
proxy_pass http://localhost:3000; | |
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-Client-Verify SUCCESS; | |
proxy_set_header X-Client-DN $ssl_client_s_dn; | |
proxy_set_header X-SSL-Subject $ssl_client_s_dn; | |
proxy_set_header X-SSL-Issuer $ssl_client_i_dn; | |
proxy_set_header X-Forwarded-Proto http; | |
proxy_read_timeout 1800; | |
proxy_connect_timeout 1800; | |
} | |
} | |
# HTTPS server | |
server { | |
listen 443; | |
server_name localhost; | |
ssl on; | |
ssl_certificate server.crt; | |
ssl_certificate_key server.key; | |
ssl_session_timeout 5m; | |
ssl_protocols SSLv2 SSLv3 TLSv1; | |
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; | |
ssl_prefer_server_ciphers on; | |
location / { | |
proxy_pass http://localhost:3000; | |
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-Client-Verify SUCCESS; | |
proxy_set_header X-Client-DN $ssl_client_s_dn; | |
proxy_set_header X-SSL-Subject $ssl_client_s_dn; | |
proxy_set_header X-SSL-Issuer $ssl_client_i_dn; | |
proxy_set_header X-Forwarded-Proto http; | |
proxy_read_timeout 1800; | |
proxy_connect_timeout 1800; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how do you do reverse proxy from localhost:8080 to https://domainname.com?