lighttpd mod alias

mod_alias lighttpd module allow you to map urls to file system. For example, you need /mrtg show /var/www/mrtg

You need to first enable mod_alias in lighttpd.conf

vi /etc/lighttpd/lighttpd.conf

Find

server.modules              = (
#                               "mod_rewrite",
#                               "mod_redirect",
#                               "mod_alias",

and remove the comment # on “mod_alias” line. It should look like

server.modules              = (
#                               "mod_rewrite",
#                               "mod_redirect",
                                "mod_alias",

To add alias, add following in lighttpd.conf

alias.url = ( "/mrtg/" => "/var/www/mrtg/" )

If you need to add more, just use

alias.url += ( "/cgi-bin/" => "/var/www/cgi-bin/" )

Alias will allow you to access files/programs in the folder with url http://yourdomain-or-ip/mrtg/

See Lighttpd

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *