Skip to content

Instantly share code, notes, and snippets.

@rubysolo
Forked from limhoff-r7/config.exs
Created October 11, 2015 19:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubysolo/62fe485cdb9686c89838 to your computer and use it in GitHub Desktop.
Save rubysolo/62fe485cdb9686c89838 to your computer and use it in GitHub Desktop.
nginx + phoenix configuration to server phoenix behind nginx at path 'phoenix'. nginx rewrites incoming URLs to strip the /phoenix, while the config.exs for phoenix ensures URLs are prefixed with /phoenix using the config.url.path
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
# Configures the namespace used by Phoenix generators
config :my_app,
app_namespace: MyApp
# Configures the endpoint
config :my_app, MyApp.Endpoint,
url: [host: "localhost", path: "/phoenix"],
http {
upstream phoenix_upstream {
server 127.0.0.1:4000;
}
server {
location /phoenix {
proxy_redirect off;
rewrite /phoenix(.*) /$1 break;
proxy_pass http://phoenix_upstream;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment