# Access nginx for testing while in maintenance

**URL:** <https://www.ruby-forum.com/t/access-nginx-for-testing-while-in-maintenance/171341>\
**Category:** NGINX\
**Created:** [June 30, 2009, 9:18pm UTC](https://www.ruby-forum.com/t/access-nginx-for-testing-while-in-maintenance/171341 "2009-06-30T21:18:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yaxm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/54ee81/32.png) [@yaxm](https://www.ruby-forum.com/u/yaxm)\
**Post date:** [June 30, 2009, 9:18pm UTC](https://www.ruby-forum.com/t/access-nginx-for-testing-while-in-maintenance/171341/1 "2009-06-30T21:18:00Z")

</div>

I have this setup: nginx =\> haproxy =\> thin( a ruby http server )  
when in maintenance mode(serving a maintenance page to end users), how  
can I still access the web server so that I can do some testing first?

I want to be able to access the server via the same domain.

maybe set some magic cookie? or pass through requests from a particular  
IP? Any idea?

---

<div class="post-metadata">

**Author:** ![yaxm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/54ee81/32.png) [@yaxm](https://www.ruby-forum.com/u/yaxm)\
**Post date:** [June 30, 2009, 9:45pm UTC](https://www.ruby-forum.com/t/access-nginx-for-testing-while-in-maintenance/171341/2 "2009-06-30T21:45:14Z")

</div>

Yaxm Y. wrote:

> I have this setup: nginx =\> haproxy =\> thin( a ruby http server )  
> when in maintenance mode(serving a maintenance page to end users), how  
> can I still access the web server so that I can do some testing first?
> 
> I want to be able to access the server via the same domain.
> 
> maybe set some magic cookie? or pass through requests from a particular  
> IP? Any idea?

You can set nginx to listen on another port. Something like:

server {  
server\_name [your-server.com](http://your-server.com);  
listen 80;  
location / {  
try\_files maintenance.html $uri $uri/ 404.html;  
…  
}  
}

server {  
server\_name [your-server.com](http://your-server.com);  
listen 8080;  
location / {  
try\_files $uri $uri/ 404.html;  
…  
}  
}

and connect via [http://your-server.com:8080/](http://your-server.com:8080/) .

You can make it a more random port so your users won’t guess it.

Jim
