# Nginx maintenance message and search engines

**URL:** <https://www.ruby-forum.com/t/nginx-maintenance-message-and-search-engines/135504>\
**Category:** Deployment\
**Created:** [April 22, 2008, 6:56pm UTC](https://www.ruby-forum.com/t/nginx-maintenance-message-and-search-engines/135504 "2008-04-22T18:56:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [April 22, 2008, 6:56pm UTC](https://www.ruby-forum.com/t/nginx-maintenance-message-and-search-engines/135504/1 "2008-04-22T18:56:19Z")

</div>

Hi,

the usual Rails configs I’ve seen floating around for nginx handle  
maintenance messages something like this:

if (-f $document\_root/system/maintenance.html) {  
rewrite ^(.\*)$ /system/maintenance.html last;  
break;  
}

I’ve not actually managed to make this work properly but this is  
actually bad in another way. It returns the maintenance message with a  
http code 200.

Users visiting the site see a maintenance message and wait or go away or  
click reload repeatedly. Search engines will see the http code 200 and  
assume this is the new page content and index and cache it!

No need to cry over spilt Google juice though, this works better:

if (-f $document\_root/system/maintenance.html ) {  
error\_page 503 /system/maintenance.html;  
return 503;  
}

location = /system/maintenance.html {  
root /path/to/your/webroot;  
}

We use 503 because rfc2616 tells us we should.

Hopefully your maintenance period isn’t long enough for this to matter,  
but still 🙂

## John.

Brightbox UK Rails Hosting

> **[UK Cloud Server Hosting & Cloud Hosting Providers](https://www.brightbox.com)**
>
> Brightbox provides simple and flexible UK owned and operated cloud hosting designed for 100% uptime. Get started now with £50 free credit.

---

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [April 24, 2008, 5:48pm UTC](https://www.ruby-forum.com/t/nginx-maintenance-message-and-search-engines/135504/2 "2008-04-24T17:48:17Z")

</div>

I want to use Sphinx for my full text search. I know I’ll need a Rails  
plugin on each of my app servers like UltraSphinx or acts\_as\_sphinx but  
do I  
need to install Sphinx itself on all the app servers? It looks like I  
really only need that daemon running on the MySQL server. Is this  
correct?

Thanks,

Raul

---

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [April 25, 2008, 5:25pm UTC](https://www.ruby-forum.com/t/nginx-maintenance-message-and-search-engines/135504/3 "2008-04-25T17:25:46Z")

</div>

Hi Raul

Since Sphinx talks directly to MySQL, it’s definitely best to have it  
on the same server. Theplugins will be able to talk to a remote server  
(provided the port isn’t blocked), so you should be fine with just the  
one Sphinx daemon.

That said, if it does prove to be a bottleneck (whether that happens  
I’ve no idea - perhaps the Engine Y. guys know more), you could have  
multiple daemons on different servers, but you only need to index the  
data once, and then you can copy the index files across to each server  
that has a Sphinx daemon.

Cheers

–  
Pat  
e: removed\_email\_address@domain.invalid || m: 0413 273 337  
w: [http://freelancing-gods.com](http://freelancing-gods.com) || p: 03 9386 0928  
discworld: [http://ausdwcon.org](http://ausdwcon.org) || skype: patallan

---

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [April 25, 2008, 5:31pm UTC](https://www.ruby-forum.com/t/nginx-maintenance-message-and-search-engines/135504/4 "2008-04-25T17:31:02Z")

</div>

Thanks for the response! I run a very beefy MySQL server so I hope with  
some  
caching of the app to keep database load down I’ll be ok.

Raul

----- Original Message -----  
From: “Pat Allan” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Friday, April 25, 2008 8:24 AM  
Subject: [Rails-deploy] Re: Sphinx: Install oinly on MySQL server?
