I have Nginx running on port 80 and Tomcat running on port 8080.
I put in the following configuration on tomcat conf/server.xml:
<Host name="localhost" appBase="web apps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="examples">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
I restart tomcat and open localhost:8080. I see the examples web app open.
I opened nginx file /etc/nginx/sites-enabled/default and updated the location configuration with:
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
#put in by me
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080/;
}
when I open browser to localhost I can see the Tomcat examples page. However when I click on any link internal to app like "servlets" I get a 404.
Do you know how I can forward the request to Tomcat so content is returned from Tomcat to Nginx?
thanks -Sonam