Skip to content

Instantly share code, notes, and snippets.

@limhoff-r7
Created May 8, 2015 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save limhoff-r7/79be3e78a5f1d39edae7 to your computer and use it in GitHub Desktop.
Save limhoff-r7/79be3e78a5f1d39edae7 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