Phoenix Beginner - image not showing

Hi, I am new to phoenix…
Managed to deploy a simple app on my Ubuntu/nginx server.
But after editing my app_web/events/index.html.eex with

<a href="http://www.phoenixframework.org/">
      <img src="/images/phoenix.png" />
    </a>

This pic is not shown.
I get: http://www.domain.de/images/phoenix-5bd99a0d17dd41bc9d9bf6840abcc089.png?vsn=d Failed to load resource: the server responded with a status of 404 (Not Found)

I followed the deploy instructions on: https://hexdocs.pm/phoenix/deployment.html#content

Not only this image, but also the background image for is not showing up
Any Idea what went wrong?
Thanks for help.

If you go to http://myserver/images/phoenix.png does it load? If not then in your project does priv/static/images/phoenix.png exist? If not then do your assets exist and can you compile them? What is your complete and entire build and run log?

1 Like

Thanks for helping…

No I get: Page not found
I do have: assets/static/images/phoenix.png and
priv/static/images/phoenix.png
as well as
priv/static/images/phoenix-5bd99a0d17dd41bc9d9bf6840abcc089.png
The manifest also contains: images/phoenix-5bd99a0d17dd41bc9d9bf6840abcc089.png

css ist working…

If you have this and it is requesting /images/phoenix.png then either your static plug is misconfigured (which if it is not touched then it is not) or a front-loader is misconfigured?

Can you upload a complete reproduceable example with detailed steps to perform so we can give it a try ourselves? This sounds odd.

1 Like

I will do so tomorrow…is late evening here…log
every step…

1 Like

ok. still busy…

So I did this and have the same result (no pics)

mix phx.new picture
Fixing db settings in config
mix phx.server runs local as expected…background image (logo ist shown) also image

preparing to deploy local =>

mix deps.get --only prod
MIX_ENV=prod mix compile
cd assets && brunch build —production
cd …
mix phx.digest

Uploading

assets => css js static vendor brunch-config package.json
config
lib
priv

Ubuntu in domain folder =>

mix deps.get
cd assets && npm install
cd …
MIX_ENV=prod mix ecto.create
PORT=4001 MIX_ENV=prod mix phx.server

Nginx

Conf
upstream phoenix_upstream {
server 127.0.0.1:4001;
}

server {
    listen       80;
	  server_name  www.domain.de;

	location / {
      root /home/domain/priv/static;
      proxy_redirect    off;
      proxy_pass http://phoenix_upstream;

      rewrite /phoenix(.*) /$1 break; 	}
}

hope can check what I did…
Greetings

Wait you aren’t running distillery via mix release?

You don’t need assets when uploading, priv contains all the assets already built up. Distillery handles that already.

Yeah you should never need to do that on your ‘prod’ box, distillery builds self-contained ready-to-run setups (or any other release system like epmd or so, just always do a release for a proper release though). :slight_smile:

Uh, your base path is not /? That is why /images does not exist, it is not matching your base path. You may need to either fixup your config to know about it (so it generates using the proper paths), or you’ll need to have nginx test ‘all’ paths to the phoenix server before passing them on to whatever might have it later. This looks like it will be a path or nginx configuration issue rather than a phoenix issue. :slight_smile:

2 Likes

Thanks…that was the reason…my fault just copy and don’t think about it…
I will check distillery now…
Greetings

1 Like