Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a subdomain with service I am going to kill.

I'd like to use 410 to mark it as such.

Is there a way to do that with lighttpd without resolving to mod_magnet and lua scripts?

share|improve this question
mod_magnet is the right solution for this, and you didn't give a reason why you don't want to use it. – Stefan Jan 7 '13 at 18:38
@Stefan Well, from docs: "While the lua language the mod_magnet uses is very powerful, mod_magnet is not meant to be a general replacement for your regular scripting environment. This is because mod_magnet is executed in the core of Lighty and EVERY long-running operation is blocking ALL connections in the server. You are warned." . But true, I have not tested this so I am probably worried needlessly. – Almad Jan 8 '13 at 11:13
Ah yes. Well, returning 410 as status code is neither a long running nor a blocking operation, so mod_magnet is fine. long running would be calculating stuff, like compression or prime number generators, and blocking operations refer to local file io or (usually worse) network io (databases, ...). – Stefan Jan 8 '13 at 14:07

Set the document root to an otherwise empty directory, and use a dynamic error handler to send a 410 response.


$HTTP["host"] == "" {
  server.document-root = "/var/www/gone"
  server.error-handler-404 = "/gone.php"

Where /var/www/gone/gone.php contains something like the following:

header("HTTP/1.1 410 Gone");
header("Status: 410 Gone");
share|improve this answer
I don't have any dynamic handlers on this server, but otherwise it's fine hack. – Almad Jan 7 '13 at 12:11
No PHP, perl, Rails, anything else? It doesn't have to be PHP... – Michael Hampton Jan 7 '13 at 13:57
Nope, it delegates backends to other servers through fcgi. – Almad Jan 7 '13 at 15:52
1. I recommend using url.rewrite-if-not-file instead of server.error-handler-404, 2. if you don't want mod_magnet it looks like you're searching for something "small" - a fastcgi/php backend is certainly not better. – Stefan Jan 7 '13 at 18:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.