Last active
November 5, 2020 04:37
-
-
Save geekforbrains/01df7c31fd62f84f453b8bc22217f3c6 to your computer and use it in GitHub Desktop.
Nginx reverse proxy for Heroku
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 heroku { | |
server myapp.herokuapp.com; | |
} | |
server { | |
server_name ~^(www\.)(?<domain>.+)$; | |
return 301 $scheme://$domain$request_uri; | |
} | |
server { | |
listen 80 default; | |
listen 443 ssl; | |
#server_name _; | |
ssl off; | |
ssl_certificate /etc/nginx/ssl/myapp.com.crt; | |
ssl_certificate_key /etc/nginx/ssl/myapp.com.key; | |
location ~ \.php$ { | |
return 444; | |
} | |
location / { | |
proxy_pass http://heroku; | |
proxy_redirect off; | |
proxy_read_timeout 5m; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-Proto http; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@george-i As per the link :