I've main domain configured at http://example.com and I'd like to use http://support.example.com with different files. How do I add subdomain support with Lighttpd web server under UNIX or Linux operating systems?
You can setup lighttpd server as follows:
- example.com will use /home/lighttpd/example.com/http as document root
- support.example.com will use /home/lighttpd/support.example.com/http as document root
Both domain can point to the same ip address or different ip address. Edit lighttpd.conf, enter:
# vi /etc/lighttpd/lighttpd.conf
Update / edit as follows:
server.modules = ( "mod_redirect", #"mod_alias", "mod_rewrite", "mod_expire", "mod_access", "mod_auth", "mod_status", "mod_fastcgi", "mod_secdownload", "mod_accesslog", "mod_compress", "mod_setenv", "mod_proxy", "mod_geoip" ) server.errorlog = "/var/log/lighttpd/error.log" accesslog.filename = "/var/log/lighttpd/access.log" index-file.names = ( "index.php", "index.html", "index.htm", "default.htm" ) server.tag = "lighttpd" server.document-root = "/home/lighttpd/example.com/http" server.username = "lighttpd" server.groupname = "lighttpd" server.port = "80" server.bind = "202.54.1.1." ###### Subdomain settings ############## $HTTP["host"] == "support.example.com"{ server.document-root = "/home/lighttpd/support.example.com/http" accesslog.filename = "/var/log/lighttpd/support.example.com/access.log" }
Save and close the file. Create required directories for subdomain:
# mkdir -p /home/lighttpd/support.example.com/http
# mkdir /var/log/lighttpd/support.example.com/
Reload or restart the lighttpd server:
# /etc/init.d/lighttpd reload
You can now upload all files at /home/lighttpd/support.example.com/http for http://support.example.com/
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop











{ 0 comments… add one now }