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
# vi /etc/lighttpd/lighttpd.conf
Update / edit as follows:
Save and close the file. Create required directories for subdomain:
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"
}
# 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
No comments:
Post a Comment