Lighttpd

From DreamHost
Jump to: navigation, search

VPS

About Lighttpd

Lighttpd is a secure, fast, compliant, and very flexible web-server that has been optimized for high-performance environments. It has a very low memory footprint compared to other webservers and takes care of cpu-load. Its advanced feature-set (FastCGI, CGI, Auth, Output-Compression, URL-Rewriting and many more) make lighttpd the perfect webserver-software for every server that suffers load problems.

DreamHost Lighttpd Version

Currently, Dreamhost's Lighttpd version option is only available to DreamHost PS customers. You can enable it through the Configure Server page in the panel.

Known Issues

Dreamhost's Lighttpd version is currently in beta, and as Lighttpd and Apache are entirely different HTTP servers, they are not 100% compatible. Currently, there are known issues with:

  • WebDAV
  • URL Rewriting
  • .htaccess files (including WebDAV, url re-writing, and password protection!)
  • Subversion
  • One-click Installs
  • Remap Sub-Dir

This means that websites with existing Apache configuration files can break and this option should be used with extreme caution!

Lighttpd Server-Per-User Customization

Dreamhost's Lighttpd version is currently set up so each user has their own Lighttpd server and can customize the configuration. If you have Lighttpd enabled, you should see a directory in your home directory called 'lighttpd' with configuration files for all of your domains. Your server's name is the same as your username.

Stopping, Starting, and Restarting Lighttpd

As each user has their own lighttpd server, they are also allowed to stop, start, and restart it.

This can be accomplished from SSH with the following commands:

sudo /etc/init.d/lighttpd stop <user>
sudo /etc/init.d/lighttpd start <user>
sudo /etc/init.d/lighttpd restart <user>

Error Log Location

Error logs seem to be located in /usr/local/dh/lighttpd/logs/username, rather than the log directory.

URL Rewriting

Note that the Dreamhost lighttpd.conf file for your server (located at /usr/local/dh/lighttpd/servers/username/lighttpd.conf) already has rewriting rules listed in it. Thus, to have URL rewrite rules on your domain, you should add them to the url rewrite rule as follows:

url.rewrite-once += (
"^/foo/([^/]*)" => "/bar/$1"
)

Note the plus.

MediaWiki URL Rewriting

This redirect can be used for MediaWiki installations using short (aka clean) URLs ($wgUsePathInfo = true;). Ultimately I did not stay with Lighttpd as it did not always seem to work correctly with various MediaWiki scripts. That said - Wikimedia sites are run on Lighttpd - so these issues could probably be overcome.

Option A (/w)

Script installed in ($wgScriptPath) root directory (/) using /w (/w/$1) as the article path ($wgArticlePath).

url.rewrite-once += (
"^/userfiles/(.+)" => "/userfiles/$1",
"^/$" => "/index.php",
"^/w/([^?]*)(?:\?(.*))?" => "/index.php?title=$1&$2"
)

Option B (/wiki)

Script installed in ($wgScriptPath) root directory (/) using /w (/wiki/$1) as the article path ($wgArticlePath).

url.rewrite-once += (
"^/userfiles/(.+)" => "/userfiles/$1",
"^/$" => "/index.php",
"^/wiki/([^?]*)(?:\?(.*))?" => "/index.php?title=$1&$2"
)

--Varnent 21:20, 24 July 2011 (PDT)

Changes to parts of domain

Change to domain extension (.com to .org)

$HTTP["host"] =~ "^(www\.|)domain\.com$" {
url.redirect += (
"^(.*)" => "http://www.domain.org$1"
) }

--Varnent 21:20, 24 July 2011 (PDT)

External Links