Enabling aliases in Lighttpd is even easier than in Apache.
Uncomment “mod_alias” in your lighty config file, /etc/lighttpd/lighttpd.conf or add it to the server.modules section if it doesn’t exist. Here’s what mine looks like:
server.modules = ( "mod_rewrite", "mod_redirect", "mod_alias", "mod_auth", "mod_fastcgi", "mod_accesslog" )
Once you have this done, you can add aliases easily with one line. This is perfect for using applications installed by your package manager where the app might be located in /usr/share/ while your web server root is something else. (/var/www/lighttpd/, /home/lighttpd/, etc.)
If you installed something through aptitude, yum, or other package manager, you probably got a config file for it installed in /etc/httpd/conf.d/ that looks something like this:
Alias /phpPgAdmin /usr/share/phpPgAdmin
<Location /phpPgAdmin>
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</Location>
The first line has all the info you need for your lighty config. The syntax is just a little different.
alias.url = ( "/phpPgAdmin" => "/usr/share/phpPgAdmin" )
Restart lighttpd and you’re done.
sudo /etc/init.d/lighttpd restart
If you want to browse your app without having to include the trailing slash, then make sure you didn’t include trailing slashes in your alias definitions (my alias.url’s above don’t have the trailing slash). Many examples show something like /doc/ => “/usr/share/doc/” but then it won’t find the index.php or index.html on its own.
If you’re using a Debian based distribution, you will get phpPgAdmin as a lowercase “phppgadmin” directory. If you install it on Fedora or CentOS from an RPM, you end up with the mixed case directory, “phpPgAdmin”.
The source package names it phpPgAdmin-x.x.x using the version number. But you could install it anywhere you like.
7:58 pm
I messed with this all night last night. A very important thing to remember is that Linux is case sensitive. So this:
alias.url = ( “/phpPgAdmin” => “/usr/share/phpPgAdmin” )
doesn’t work while this:
alias.url = ( “/phppgadmin” => “/usr/share/phppgadmin” )
does.