I have 2 servers,
with IP xx.xx.xx.xx, situated in Germany ... (running frontend: nginx(static content), backend: Apache2)
with IP yy.yy.yy.yy, situated in Italy...
All requests at the moment is sending to server with IP xx.xx.xx.xx, How can I proxy all traffic from xx.xx.xx.xx to yy.yy.yy.yy using nginx ...
request proxy, request Internet -> xx.xx.xx.xx(nginx) -> yy.yy.yy.yy(nginx, Apache) <- <- response proxy, response
In NGINX Plus Release 5 and later, NGINX Plus can proxy and load balance Transmission Control Protocol) (TCP) traffic. TCP is the protocol for many popular applications and services, such as LDAP, MySQL, and RTMP. In NGINX Plus Release 9 and later, NGINX Plus can proxy and load balance UDP traffic.
By using the nginx forward proxy we can masking the location and IP for gaining access to services. Nginx forward proxy will continuing the request on behalf of the client. At the time when the host server will accept the request then only we can see the IP of the nginx proxy server.
Nginx is an open source web server that can also serve as a reverse proxy. Apart from being used to host websites, it's also one of the most widely used reverse proxy and load balancing solutions.
The proxy_pass docs say: This directive sets the address of the proxied server and the URI to which location will be mapped. So when you tell Nginx to proxy_pass , you're saying "Pass this request on to this proxy URL".
For others. Answer for subject is configure nginx like:
server { listen 80; server_name mydomain.com; location / { access_log off; proxy_pass http://mydomain.com:8080; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With