Lighttpd is also a lightweight and good web server. like apachehttpserver, when I first used lighttpd in, lighttpd supported flv streaming media playback and anti-leeching, so we need to use it. Today, we will focus on how to configure the settings of multiple virtual hosts and domain names. take the V1.7 version of Lighttpd as an example: 1. configure multiple virtual hosts to open the Lighttpd installation project.
Lighttpd is also a lightweight and good web server. like apachehttpserver, when I first used lighttpd in, lighttpd supported flv streaming media playback and anti-leeching, so we need to use it. Today, we will focus on how to configure multiple virtual hosts and domain name settings. take Lighttpd V1.7 as an example:
1. configure multiple virtual hosts
Open the etc/Lighttpd. conf file in the lighttpd installation directory, and add the following section at the end:
- $HTTP["host"] == "test.mzone.cc"{
- server.document-root = "/webapps/mzone/test"
- server.errorlog = "/usr/local/lighttpd/logs/mzone-test-error.log"
- accesslog.filename = "/usr/local/lighttpd/logs/mzone-test-access.log"
- }
If you need multiple virtual hosts, set multiple replication segments.
2. multiple domain names direct to the same directory
Sometimes we need to configure multiple domain names for the same application, then we can use the following section for configuration:
- $HTTP["host"] =~ "^(app1\.mzone\.cc|app2\.mzone\.cc)$"{
- server.document-root = "/webapps/mzone/app"
- server.errorlog = "/usr/local/lighttpd/logs/mzone-app-error.log"
- accesslog.filename = "/usr/local/lighttpd/logs/mzone-app-access.log"
- }
Note that this is different from the configuration of a single domain name: The former uses=The latter uses= ~In this way, we have completed the configuration of multiple domain names for one application, and then restarted lightpd.