BarelyFunctional
Continuing on from another recent post of mine where I was helped to fix a Phoenix 1.3 app use edeliver to build it (thank you), I’m now finding I can start the production server, but can’t see the app.
Here’s what I’ve done/checked:
- It runs locally on my mac on
port 4000 - I’m building and hosting it on the same server that has erlang installed
- Just to be sure, I’ve tried building it with and without the erlang runtime
It’s behind an nginx reverse proxy server that hasn’t changed in settings since previously successfully built/deployed/ran a Phoenix 1.2 app on the same server.
I’m trying to understand how to read the logs in /var/log/ to see if the site is working.
Where do I start?
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
NobbZ
What is it you can’t see? Phoenix generated content or static files? What do you see instead? Can you SSH into your server and verify that your application id running, listening and serving via
ps,netsat,curl/links/lynx?BarelyFunctional
testing this with the default phx.new project - it can’t be seen.
the nginx reverse proxy server redirects from http://www.mydomain to http://mydomain and gives a 404.
the public ip of the build/production server - returns nothing.
Here’s the
topoutputIs there a cowboy log or something I can check to see if the site is being served?
jesse
Are you using Distillery to build a release? If so, do you have
server: trueset in yourprod.exs?BarelyFunctional
Yeah, and for whatever reason that line was uncommented - I’ve uncommented it now thanks.
However, I’m getting a 502 error after the redirect from www to the domain - here’s the exact error from the reverse proxy nginx error.log:
*1 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream, client: xxx.xx.xx.xx, server: mytestphoenixapp.tld, request: "GET / HTTP/1.1", upstream: "http://xx.xxx.xx.xxx:8080/", host: "mytestphoenixapp.tld"I explicitly set the http port in prod.exs instead of relying on the default as it says one should (in Phoenix
1.3):Is this just a path issue in my nginx config?
jesse
Are you able to curl localhost from the server itself? If you SSH into the machine and
curl localhost:8080what happens?BarelyFunctional
On the production server:
curl localhost:8080gives:
curl: (7) Couldn't connect to serverwhich is confusing because from the dev mac I can:
mix edeliver start productionreturns:
START DONE!and
mix edeliver ping productionreturns:
pongjesse
Did you ever get this working? It sounds like the server isn’t listening on port 8080 for some reason. Can you post your redacted prod.exs file?
NobbZ
I think it is the same problem as in another thread where I asked him for the
prod.exsyesterday…BarelyFunctional
Hi jesse,
Thanks - no, I didn’t get it going - you’re right the server appears to not be listening on port 8080, and I couldn’t find any reason for that. The strange thing is, the Phoenix 1.2 app I had working with Distillery and Edeliver uses the same port, nginx reverse proxy config…
To try to find out what’s wrong, I’ve decided to start from scratch with the default Phoenix 1.3 install, and see if you and others can help me spot what I’m doing wrong.
The app is called phx1p3.
I want to build the app for deployment with erts included, not install erts on the production server.
My production server user for the deployed app is called freebsd.
On dev machine
Install Phx 1.3 App
$ mix phx.new phx1p3$ cd phx1p3Generate new secret for app:
$ mix phx.gen.secretCopy outputted secret into
config/prod.secret.exsAdd elixir/phoenix packages
to
mix.exsfor what my project needs eg bamboo for email:$ vim mix.exsAdd:
Install NPM packages:
$ cd phxp1p3/assets$ npm install --save-dev copycat-brunch$ npm install --save font-awesomeUpdate
assets/brunch-config.jsfor the installed NPM packages:$ vim assets/brunch-config.jsChange:
to:
Install Phoenix and NPM packages/dependencies:
$ mix deps.get —allCreate project database:
$ mix ecto.createTest app works locally:
$ mix phx.serverGit
$ git initAdd Edeliver’s releases directory to
.gitignore$ echo ".deliver/releases/" >> .gitignore$ git add .$ git commit -m "initial commit"Edit prod.exs
Replace
load_from_system_env: true, withhttp: [port: 8080], and uncomment the lineconfig :phoenix, :serve_endpoints, true.$ vim config/prod.exsInstall Distillery and Edeliver
Edeliver
Create directory and config file for Edeliver:
$ mkdir .deliver$ touch .deliver/config$ vim .deliver/configPaste and edit config from Deploy Early and Often: Deploying Phoenix with Edeliver and Distillery (Part Two), and change:
prefix phoenix. to phx. (for Phoenix 1.3).
add change of path for change in Phoenix 1.3 directory eg
cd '$BUILD_AT/assets'for NPM install.Distillery
Create Distillery
reldirectory and config file:$ mix release.initEdit the generated Distillery config file to set:
default_environment: :proddev environment to not build
ertsprod environment to build
erts$ vim rel/config.exsOn Staging or Production Server
Create prod.secret.exs
in deployment user’s home directory:
$ touch ~/prod.secret.exsCopy contents of
config/prod.secret.exson dev machine to the above file on the server via clipboard.Create Postgresql Database and Assign User Privileges
Switch to Postgresql user
$ sudo -i -u postgresLog into Postgresql console
$ psqlpostgres=# CREATE DATABASE phx1p3_prod;Create user with same name as the user account running the Phoenix app:
postgres=# CREATE USER freebsd WITH PASSWORD 'password';Grant that user privileges to new database
postgres=# GRANT ALL PRIVILEGES ON DATABASE phx1p3_prod TO freebsd;Quit Postgresql and exit user to server’s deployment user:
postgres=# \q$ exitBuild, Deploy, and Start on Production Server
$ mix edeliver build release production --verbose$ mix edeliver deploy release to production --verbose$ mix edeliver start productionNginx Server Config
Relevant part of nginx.conf:
$ cat /usr/local/etc/nginx/nginx.conf#Production Server hosting Phx1p3 app#Nginx Reverse Proxy Server's redirect request to www.myapp.tld; on port 80 to http:/myapp.tld; on port 80NobbZ
Again:
How does your
prod.exslook like? After starting your application, what doesnetstat -lnpttell you (maybe that its not available on BSD)?