Nginx how to forward 8080 to 80

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 :/


Solution 1:

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