access nginx for testing while in maintenance

Jim Ohlstein jim.ohlstein at gmail.com
Tue Jun 30 23:37:34 MSD 2009



Yaxm Yaxm 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;
   listen 80;
   location /  {
      try_files  maintenance.html  $uri  $uri/  404.html;
      ...
   }
}


server   {
   server_name  your-server.com;
   listen 8080;
   location /  {
      try_files  $uri  $uri/  404.html;
      ...
   }
}

and connect via http://your-server.com:8080/ .

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


Jim







More information about the nginx mailing list