Welcome! Log In Create A New Profile

Advanced

Proxy to forward an incoming domain to another port

Posted by dimol 
Proxy to forward an incoming domain to another port
July 02, 2023 03:11PM
Hi.

I am fighting with my nginx config.

What I will do:

I have got some docker stacks (php, mysql, nginx, ... ) wich are available in my browser by localhost:[port]
Now I would like to make a config for each domain to forward it to a specific port on localhost.

my-domain (which is on Port 80) to localhost:8080

/etc/host
127.0.0.1 my-domain

nginx is configured as a vhost for all of my domains in
/etc/nginx/sites-enabled/proxy.conf

like this
/etc/nginx/sites-enabled/proxy.conf
server {
listen 80;
server_name my-domain;
location / {
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:40000;
proxy_redirect off;
}
}

If i call localhost:40000 in my browser I get the portainer login of the docker container I would like to load.
If I call myomain in my browser, I only the the nginx default index page.

Any hints?

Regards
D from D
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 103
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready