Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I would like to configure my system so nginx is serving all of the the static files, while Tomcat is handling the dynamic .jsp pages.

Is there a best practice for this?

share|improve this question

closed as off-topic by Ward, masegaloeh, Jenny D, kasperd, Katherine Villyard May 24 at 23:16

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

7  
Please consider accepting some of your previous answers. Why should I go to the trouble of helping you, when you don't give anything back? If you don't know what I mean, I suggest you read the FAQ. –  Bryan Apr 2 '10 at 12:41

1 Answer 1

Does tomcat accessible via HTTP? If yes, then Imagine we have some tomcat which serves on the same machine on port 88 queries which ends up with .jsp

The config file will be like:

location / {
  root /path/to/static/files;
}

location ~* \.jsp {
  proxy_pass http://127.0.0.1:88;
}

The main idea is that nginx proxies requests that it couldn't handle to specific backend (backend will see request from 127.0.0.1).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.