ykostov

ykostov

Hello,
I am on my way deploying a phoenix app in a remote droplet by DO. Using a nginx server. So, I have created my server, all working, but on port :4000 (obviously). I am trying to forwards this port to my domain example.com, but something isnt right for sure. Viewed this post Need help with Nginx configuration, to serve phoenix app, but frankly idk what more to do.

My /etc/nginx/sites-available/example.com

upstream phoenix {
  server 127.0.0.1:4000 max_fails=5 fail_timeout=60s;
}
server {
        server_name  iex.venus.home;
        listen 80;
        client_max_body_size 30M;
        location / {
                allow all;
                proxy_http_version 1.1;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_set_header X-Cluster-Client-Ip $remote_addr;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_pass http://phoenix;
        }
}

And my phoenix app is located (if necessary) → /var/www/example.com/phoenix.

The way is that my application is visible on IP:4000, but I want it forwarded to example.com. Hope everything is clear.

Best Regards,
ykostov

Showing Posts 1 to 5

crova

crova

Does your server config have a symbolic link to nginx/sites-enabled?

experimentix

experimentix

check this video video if it helps

Exadra37

Exadra37

I don’t know how to help you with your Nginx configuration but I can suggest you a more easy and automated setup, that I use for my Video Notes web app running on DO with Traefik and Docker.

I have automated the creation of the server with Traefik, Docker and LetsEncrypt via a cloud-init file that you upload when creating the dropplet:

The cloud-init file will also do a lot of security hardening during the creation of the server.

derek-zhou

derek-zhou

You need to tell us what is the symptom, or it is very hard to help you. The relevant part of my config file is:

        location / {
                 proxy_set_header Host $host;
                 proxy_set_header X-Real-IP $remote_addr;
                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                 proxy_set_header X-Forwarded-Proto  $scheme;
                 proxy_set_header X-Forwarded-Host  $host;
                 proxy_set_header X-Forwarded-Port  $server_port;
                 proxy_pass http://localhost:4001/;
                 proxy_redirect off;
        }
        # required for websocket
        location /live {
                 proxy_http_version 1.1;
                 proxy_set_header Upgrade $http_upgrade;
                 proxy_set_header Connection "upgrade";
                 proxy_set_header Host $host;
                 proxy_set_header X-Real-IP $remote_addr;
                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                 proxy_set_header X-Forwarded-Proto  $scheme;
                 proxy_set_header X-Forwarded-Host  $host;
                 proxy_set_header X-Forwarded-Port  $server_port;
                 proxy_pass http://localhost:4001/live;
                 # raise the proxy timeout for the websocket
                 proxy_read_timeout 6000s;
        }
akashv

akashv

@ykostov please check this. Also you can run sudo nginx -t to check if your configuration is valid.
You can create the symbolic link with below command after moving to /nginx/sites-enabled directory
sudo ln -s ../sites-available/xyz.conf xyz.conf.
And check if the nginx service itself is running.

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews