Score:0

Nginx how to forward 8080 to 80

cn flag

Currently i have wordpress running on 192.168.2.1:8080

Nginx listening on port 80

I want to redirect all http request on port 8080 "http://192.168.2.1:8080" to port 80 "http://192.168.2.1"

My current nginx conf me does the opposite : "http://192.168.2.1" points me to "http://192.168.2.1:8080"

server {
listen 80;
server_name 192.168.2.1;

location / {
  proxy_pass http://192.168.2.1:8080/;
}

How should i do this ?

PS : I've really tried all previous threads :/

djdomi avatar
za flag
What are you trying to solved? i belive here is an [X-AND-Y-Problem](https://faq-database.de/doku.php?id=en:x-and-y-problem)
Score:1
ar flag

Maybe have config like

server {
listen 8080;
server_name 192.168.2.1;

location / {
  proxy_pass http://192.168.2.1:80/;
}

Listen is what you want for nginx to receive connections from, and as we can guess the proxy_pass is where you want them to go

djdomi avatar
za flag
If you write http:// without a double point which is, meaning, selecting a port — port 80 will be used by default - Both Works, but proxy_pass http://192.168.2.1:80/; the `:80` is not needed, due `proxy_pass http://192.168.2.1/;` will do the same. But Remind, about the Slash on the end, this could make a difference how requests will be handled.
Segfault avatar
cn flag
This is not a proper answer, i can not have nginx listening on the same port as wordpress container is already occupying port 8080.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.