Aryan R
Aryan R

Reputation: 233

How to map a domain name to Tomcat app?

I have tomcat7 running an app which I currently access as

http://ip:8080/app/

I can not change the port or the app name. Neither can I make it run as root.

I have nginx installed on this machine. I want ngix to map a domain name mydomain.com to http://ip:8080/app/

What kind of configuration should I use ?

IMPORTANT: Whatever solution you suggest should not break anything else that nginx is doing. My nginx is currently mapping a domain name to ip:8080.

I think in order to map domain name to path I will have to probably use some sort of redirect/rewrite rules.

Upvotes: 0

Views: 192

Answers (1)

Roman
Roman

Reputation: 6646

I'm not sure what exactly we shouldn't break, but I believe this will do the job:

server {
    server_name mydomain.com;

    location / {
        proxy_pass http://ip:8080/app/;
        ...
    }
}

Upvotes: 1

Related Questions