Forward nginx to Apache Tomcat

Posted by erdimeola on Server Fault See other posts from Server Fault or by erdimeola
Published on 2012-11-02T09:45:53Z Indexed on 2012/11/02 11:03 UTC
Read the original article Hit count: 237

Filed under:
|
|
|
|

I'm totally new to nginx.

I want to forward two subdomains to the two applications in my apache tomcat server.

As I searched over internet, I found that rewrite does the forwarding but I cannot see forwarding.

Here is my server configuration

server {
    listen 80;
    server_name  subdomain1.domain.com;
    rewrite ^ http://tomcat.ip:8080/app1$request_uri? permanent;
}

server {
    listen 80;
    server_name  subdomain2.domain.com;
    rewrite ^ http://tomcat.ip:8080/app2$request_uri? permanent;
}

Whenever I invoke subdomain1.domain.com or subdomain2.domain.com, I'm redirected to the main page of nginx which states that nginx is successfully installed and further configuration is needed.

So, How can I do the forwarding?

© Server Fault or respective owner

Related posts about apache2

Related posts about tomcat