# Nginx as proxy server

**URL:** <https://www.ruby-forum.com/t/nginx-as-proxy-server/138126>\
**Category:** NGINX\
**Created:** [May 20, 2008, 1:20pm UTC](https://www.ruby-forum.com/t/nginx-as-proxy-server/138126 "2008-05-20T13:20:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kaushal\_Shriyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/838e76/32.png) [@Kaushal\_Shriyan](https://www.ruby-forum.com/u/Kaushal_Shriyan)\
**Post date:** [May 20, 2008, 1:20pm UTC](https://www.ruby-forum.com/t/nginx-as-proxy-server/138126/1 "2008-05-20T13:20:14Z")

</div>

Hi

Is there a documentation on setting up nginx as proxy server

Thanks and Regards

Kaushal

---

<div class="post-metadata">

**Author:** ![Kaushal\_Shriyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/838e76/32.png) [@Kaushal\_Shriyan](https://www.ruby-forum.com/u/Kaushal_Shriyan)\
**Post date:** [May 20, 2008, 2:06pm UTC](https://www.ruby-forum.com/t/nginx-as-proxy-server/138126/2 "2008-05-20T14:06:03Z")

</div>

Hello Kaushal,

Tuesday, May 20, 2008, 6:10:56 PM, you wrote:

> Hi

> Is there a documentation on setting up nginx as proxy server

[http://wiki.codemongers.com/NginxConfiguration](http://wiki.codemongers.com/NginxConfiguration)

> Thanks and Regards

---

<div class="post-metadata">

**Author:** ![Kaushal\_Shriyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/838e76/32.png) [@Kaushal\_Shriyan](https://www.ruby-forum.com/u/Kaushal_Shriyan)\
**Post date:** [May 20, 2008, 2:21pm UTC](https://www.ruby-forum.com/t/nginx-as-proxy-server/138126/3 "2008-05-20T14:21:26Z")

</div>

On Tue, May 20, 2008 at 5:24 PM, Denis F. Latypoff [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > Thanks and Regards

Hi Denis

Thanks for the quick reply

I have this in the “nginx.conf” file and have restarted ngnix. Basically  
I  
want to set it as a simple proxy server

```
    location / {
        root /var/www/example/htdocs;
        index index.html index.htm;
        proxy_pass http://localhost:8000;
    }

```

Am i missing some thing

Thanks and Regards

Kaushal

---

<div class="post-metadata">

**Author:** ![Kaushal\_Shriyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/838e76/32.png) [@Kaushal\_Shriyan](https://www.ruby-forum.com/u/Kaushal_Shriyan)\
**Post date:** [May 20, 2008, 3:14pm UTC](https://www.ruby-forum.com/t/nginx-as-proxy-server/138126/4 "2008-05-20T15:14:50Z")

</div>

Hello Kaushal,

Tuesday, May 20, 2008, 7:12:45 PM, you wrote:

> On Tue, May 20, 2008 at 5:24 PM, Denis F. Latypoff [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > Thanks and Regards

> Hi Denis

> Thanks for the quick reply

> I have this in the “nginx.conf” file and have restarted ngnix. Basically I  
> want to set it as a simple proxy server

> ```
> location / {
> root /var/www/example/htdocs;
> index index.html index.htm;
> 
> ```

```
          error_page 404 = @proxy;

```

> ```
> }
> 
> ```

```
      location @proxy {
          proxy_pass http://localhost:8000;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For 

```

$proxy\_add\_x\_forwarded\_for;  
}

> Am i missing some thing

don’t forget to handle X-Real-IP header in your backend (mod\_rpaf for  
apache 2.x, or mod\_realip for Apache 1.3)

> Thanks and Regards
