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"
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 *;
}