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?

  • 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"] == "gone.example.com" {
  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");
  • 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
  • 2
    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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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