What I´m looking for is setup a reverse proxy with nginx and forward them to another nginx server. The reverse proxy should forward all traffic to the webserver to a related port.
Nginx Reverse Config:
server {
listen 80;
root /var/www/;
index index.php index.html index.htm;
server_name example.com;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://192.168.0.10:1478;
}
location ~ /\.ht {
deny all;
}
}
In this case the reverse should redirect all traffic to the webserver 192.168.0.10:1478
Nginx Webserver Config:
server {
listen 1478;
root /var/www/public_html;
index index.html index.htm index.php;
server_name IP-Reverse;
}
This is not working... Is there a config mistake?
In this case I use 2 Servers, 1 Webserver nginx and one reverse nginx. All traffic should forwared from the reverse proxy to the webserver on a specific port. All requests from the reverse proxy to the webserver should be only allowed from the reverse ip