Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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
5  
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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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