Nginx server conf file for Phoenix local development
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
# This config for Nginx provides you a local domain | |
# (www.phoenix.dev) for Phoenix webserver development. | |
# | |
# ## Prerequisites | |
# - You must update you /etc/hosts file accordingly. | |
# - You must create a self-signed certificate if you | |
# intend on using the HTTPS proxying. | |
# | |
# Add this file in the /servers directory accompanying | |
# your nginx.conf file. | |
# | |
# See [this article](https://medium.com/jobteaser-dev-team/the-basic-solution-for-local-domains-d6a0f73bace4#.8el52u5i0) | |
# for more information. | |
# HTTP | |
server { | |
listen 80; | |
server_name www.phoenix.dev; | |
location / { | |
proxy_pass http://localhost:4000; | |
} | |
# Phoenix livereload (using websockets) | |
location /phoenix/ { | |
proxy_pass http://localhost:4000/phoenix/; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
} | |
# HTTPS | |
server { | |
listen 443 ssl; | |
server_name www.phoenix.dev; | |
ssl_certificate phoenix.crt; | |
ssl_certificate_key phoenix.key; | |
location / { | |
proxy_pass http://localhost:4000; | |
} | |
# Phoenix livereload (using websockets) | |
location /phoenix/ { | |
proxy_pass http://localhost:4000/phoenix/; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment