# Static index file in Nginx+Apache

**URL:** <https://www.ruby-forum.com/t/static-index-file-in-nginx-apache/215909>\
**Category:** NGINX\
**Created:** [January 19, 2012, 9:21am UTC](https://www.ruby-forum.com/t/static-index-file-in-nginx-apache/215909 "2012-01-19T09:21:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 19, 2012, 9:21am UTC](https://www.ruby-forum.com/t/static-index-file-in-nginx-apache/215909/1 "2012-01-19T09:21:32Z")

</div>

location / {  
index index.htm;  
proxy\_pass [http://127.0.0.1:8080](http://127.0.0.1:8080);  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header Host $http\_host;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
}

location ~\* .(jpg|jpeg|gif|png|ico|css|bmp|js|swf|html|htm)$ {  
root /home/site/public\_html/;  
}

I need process the request “GET /” via Nginx (as static file).  
Added directive “index” has no effect, the request passed to backend.  
What’s wrong?

Thanks.

Posted at Nginx Forum:

> **[Static index file in Nginx+Apache](https://forum.nginx.org/read.php?2,221434,221434#msg-221434)**
>
> location / { index index.htm; proxy\_pass http://127.0.0.1:8080; proxy\_set\_header X-Real-IP $remote\_addr; proxy\_set\_header Host $http\_host; proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for; } location ~\* \\.(jpg|jpeg|gif

---

<div class="post-metadata">

**Author:** ![ilin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/22d042/32.png) [@ilin](https://www.ruby-forum.com/u/ilin)\
**Post date:** [January 19, 2012, 9:32am UTC](https://www.ruby-forum.com/t/static-index-file-in-nginx-apache/215909/2 "2012-01-19T09:32:41Z")

</div>

On Thu, Jan 19, 2012 at 3:21 PM, ilin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> }
> 
> I need process the request “GET /” via Nginx (as static file).  
> Added directive “index” has no effect, the request passed to backend.  
> What’s wrong?

since “/” doesn’t match the latter part, just add this one location  
block:

location = / { }

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)

---

<div class="post-metadata">

**Author:** ![ilin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/22d042/32.png) [@ilin](https://www.ruby-forum.com/u/ilin)\
**Post date:** [January 19, 2012, 10:41am UTC](https://www.ruby-forum.com/t/static-index-file-in-nginx-apache/215909/3 "2012-01-19T10:41:21Z")

</div>

Nginx responded 404

Posted at Nginx Forum:

> **[Re: Static index file in Nginx+Apache](https://forum.nginx.org/read.php?2,221434,221439#msg-221439)**
>
> location / { index index.htm; proxy\_pass http://127.0.0.1:8080; proxy\_set\_header X-Real-IP $remote\_addr; proxy\_set\_header Host $http\_host; proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for; } location ~\* \\.(jpg|jpeg|gif

---

<div class="post-metadata">

**Author:** ![ilin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/22d042/32.png) [@ilin](https://www.ruby-forum.com/u/ilin)\
**Post date:** [January 19, 2012, 11:51am UTC](https://www.ruby-forum.com/t/static-index-file-in-nginx-apache/215909/4 "2012-01-19T11:51:19Z")

</div>

On Thu, Jan 19, 2012 at 4:40 PM, ilin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Nginx responded 404

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)
