Nginx maintenance message and search engines

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 :slight_smile:

John.

Brightbox UK Rails Hosting

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

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: [email protected] || m: 0413 273 337
w: http://freelancing-gods.com || p: 03 9386 0928
discworld: http://ausdwcon.org || skype: patallan

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” [email protected]
To: [email protected]
Sent: Friday, April 25, 2008 8:24 AM
Subject: [Rails-deploy] Re: Sphinx: Install oinly on MySQL server?