Created
February 16, 2018 14:33
-
-
Save ajaxray/f17f727848dd77778fa9610b99064fa2 to your computer and use it in GitHub Desktop.
Serve go / Golang HTTP/HTTPS app with Nginx as a subdomain
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
upstream go-http-backend { | |
server 127.0.0.1:3000; | |
keepalive 20; | |
} | |
server { | |
listen 80; | |
server_name sub.domain.com; | |
# adjust as per app's requirement | |
access_log off; | |
error_log /dev/null crit; | |
# required for keepalives to be used | |
proxy_http_version 1.1; | |
proxy_set_header Connection ""; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $remote_addr; | |
proxy_set_header Host $host; | |
location / { | |
proxy_pass http://go-http-backend; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment