Last active
October 9, 2020 07:46
-
-
Save v0d1ch/0bf71bc167efdac4856073d10f4c8859 to your computer and use it in GitHub Desktop.
nginx yesod setup as 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
upstream yesod { | |
server 127.0.0.1:3000; | |
keepalive 8; | |
} | |
# the nginx server instance | |
server { | |
listen 0.0.0.0:80; | |
server_name haskell-serbia.com; | |
access_log /var/log/nginx/access_yesod.log; | |
error_log /var/log/nginx/error_yesod.log; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_pass http://yesod/; | |
proxy_redirect off; | |
} | |
location /excluded { | |
return 403; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To get the IP headers forwarded by nginx, to be logged by Yesod in production, I needed to do
export YESOD_IP_FROM_HEADER=true
. Thank you.