Configure Apache Multi-Domain Name Server in Ubuntu and ubuntuapache
1. Objectives:
Access different domain names on the local machine to access different directories. That is, access a.com to access the program under the/var/www/a directory, and access B .com to access the program under the/var/www/B directory.
2. Problems:
/Etc/apache2 folder directory
Mod-available module conf-available configuration sites-available domain name/virtual directory ports. conf interface file
Module conf-enabled configuration sites-enable Domain Name/virtual directory envvars apache2.conf main configuration
The configuration file of apache in ubuntu is relatively scattered compared with a configuration file in Windos. This is for low coupling. If an error occurs when one site is configured, the operation of other sites is not affected.
Apache2.conf is the main configuration file. This file is like a building framework, which aggregates the configuration files in the externally dispersed enable directory.
The reason is clear. Create a. conf B. conf in sites-available and create a soft link in sites-enable.
However, accessing all domain names directs to the www root directory. Sites-enable has only one configuration file.
3. Solve the Problem
The confusion has been fruitless for several days. Finally, I found the answer in a post. I still cannot fully understand the specific principle. I will record it and then flip it over.
Comment out the following two lines in the default configuration file.
ErrorLog $ {APACHE_LOG_DIR}/error. log is changed
# ErrorLog $ {APACHE_LOG_DIR}/error. log
CustomLog $ {APACHE_LOG_DIR}/access. log combined is changed
# CustomLog $ {APACHE_LOG_DIR}/access. log combined
Refer:
Http://forum.ubuntu.org.cn/viewtopic.php? T = 341070