Proxy/caching with Apache and index.html files

Hi all,

I’ve got an nginx frontend/apache backend setup with nginx using
proxy_pass to pass requests for location / to my Apache server on
localhost:8080. I’ve got a location setup to catch css/js/images/html
etc. and serve them statically via nginx (fairly standard I believe).

My question is, this works for everything (including html files, which I
want served statically via nginx) apart from default index.html files
that are matched by /. If I were to go to domain.com/index.html for
example, this would be served by nginx, but if I go to domain.com/ and
the default file is an index.html file I want it served by nginx (as
opposed to a default index.php file which would still be passed through
to Apache). What config do I need to get nginx to recognise this special
case?

Matt.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,118322,118322#msg-118322

It is not going to make any difference whether nginx or apache serves
the file. Just leave things are they are.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,118322,118622#msg-118622

In which case, what would be the point in having nginx serve anything
static at all in terms of JS and CSS files which are similar, or is
there not any point in using nginx? Surely the advantage should either
apply to both or not at all?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,118322,118677#msg-118677

On Tue, Aug 10, 2010 at 10:55:21AM -0400, MattWard wrote:

example, this would be served by nginx, but if I go to domain.com/ and
the default file is an index.html file I want it served by nginx (as
opposed to a default index.php file which would still be passed through
to Apache). What config do I need to get nginx to recognise this special
case?

With the following configuration nginx will pass *.php requests to
Apache:

location / {
index index.html index.php;
root /path/to/files;
}

location ~ .php$ {
proxy_pass http://lcoalhost:8080;
}

/dir/ > /dir/index.php case will be handled via internal redirect,
please, look this:
http://nginx.org/en/docs/http/request_processing.html#simple_php_site_configuration


Igor S.
http://sysoev.ru/en/

Exactly what I was looking for, thanks Igor :slight_smile:

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,118322,118962#msg-118962

Ha.

I thought you had Igor’s arrangement plus a static location to start
with which is why I said leave as is but reading again, I see you were
passing “/” to apache.

Glad you are sorted.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,118322,120102#msg-120102

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs