Huu Phan | Blog Linux operating system | Linux operating system -Blog Huu Phan | www.huuphan.com
huuphan.com. Powered by Blogger.

My blog about Open Source: Zimbra Mail Server,linux,bash script,centos,linux command...

How to NGINX Solution for Apache ProxyPassReverse

NGINX Solution for Apache ProxyPassReverse

Apache configure

<VirtualHost myhost:8888>
    ServerName myhost
    DocumentRoot /path/to/myapp/public
    ProxyPass / http://myapp:8080/
    ProxyPassReverse / http://myapp:8080/
</VirtualHost>

Nginx Reverse Proxy Configure


Nginx not have ProxyPassReverse. Therefore a few missing HTTP header. Solve problem Nginx for Apache ProxyPassReverse as below:
server {
    listen 80;
    server_name  www.huuphan.com;
    location /home {
    proxy_set_header Host $host;
        proxy_pass http://IP_Apache:8888;
    }
    location /app {
    proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host:$server_port;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://IP_TOMCAT:8080;
    }
}

post new :

Huu Phan | Blog Linux operating system | Huu Phan ~ Zimbra Mail Server,linux,bash script,centos,linux command | www.huuphan.com

This Blog is protected by DMCA.com