Skip to content

Instantly share code, notes, and snippets.

@theanht1
Created February 1, 2019 07:45
Show Gist options
  • Select an option

  • Save theanht1/7082c73740d487d3eb005cc5da1906a2 to your computer and use it in GitHub Desktop.

Select an option

Save theanht1/7082c73740d487d3eb005cc5da1906a2 to your computer and use it in GitHub Desktop.
Phoenix production deployment

Phoenix application deployment

Normal remote deploy:

Folow this link

NOTE: Configure for Endpoint should be changed like this:

config :foo, Foo.Endpoint,
  check_origin: ["//mysite.com"],
  http: [ip: {0, 0, 0, 0}, port: 4000],
  secret_key_base: "A LONG SECRET"

Reverse proxy via Nginx

Nginx config:

  location / {
    proxy_http_version 1.1;
    proxy_pass http://127.0.0.1:4000;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header        X-Forwarded-For   $remote_addr;
    proxy_set_header        X-Real-IP         $remote_addr;
    proxy_set_header        Host              $host;
    proxy_set_header Access-Control-Allow-Origin *;
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment