Forward nginx to Apache Tomcat
- by erdimeola
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?