nginx and tomcat integrated but how to serve static files

Francis Daly francis at daoine.org
Tue Dec 11 12:26:20 UTC 2012


On Tue, Dec 11, 2012 at 02:18:27PM +0530, Irfan Khan wrote:

Hi there,

> My config is same as earlier. I had tried to access /foo/learning.html from
> Nginx. But if I keep tomcat server off then I am unable to load this page.

If you use the config you posted in the first mail, /foo/learning.html
should give you the file /var/www/nginx-default/foo/learning.html, and
should not involve tomcat at all (so shouldn't change whether tomcat is
on or off).

Does it give you that file?

If not, what does it give you instead?

Probably best is to copy-paste the output of

  curl -i http://192.168.0.16/foo/learning.html

if it is not what you want it to be.

The later mails, including this one, don't appear to include any other
valid nginx config.

> If I keep tomcat server up and try for some files (blah.html)which is not
> exists then tomcat reports an error on page.  

  curl -i http://192.168.0.16/blah.html

should show you the file /var/www/nginx-default/blah.html, or an nginx
http 404 message.

  curl -i http://192.168.0.16/abc/blah.html

should show you whatever tomcat produces, if you use your original
configuration; or should show you the content of (probably)
/usr/local/nginx/html/abc/blah.html, if you add the change suggested.

> I have also tried giving full access to webapps directive just for testing
> purpose. Nothing worked!

I want to use the nginx config that you provide, to reproduce the error
that you report.

So far, I can't.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list