Configuration of the 1.apache2
First of all, to configure the apache2, if not configured, please refer to my previous blog: Lamp configuration
2. The resolution of the domain name
Resolves a record of www and @ for all domain names to the IP of the cloud server
3. Configuration of the virtual Host 1. Configuring httpd.conf
- If etc/httpd/conf/httpd.conf is present, configure this httpd.conf
- If etc/httpd/conf/httpd.conf does not exist, we need to create a new httpd.conf under/etc/apache2, configure this httpd.conf, and then/etc/apache2/ Introduction of httpd.conf in apache2.conf
引入方式: 在apache2.sonf中加入一行 Include httpd.conf
HTTPD.CONF configuration:
<VirtualHost *:80>ServerName www.123.com #浏览器访问www.123.com的时候DocumentRoot /var/www/123 #123.com的内容目录DirectoryIndex index.html</VirtualHost><VirtualHost *:80>ServerName www.456.com #浏览器访问456.com的时候DocumentRoot /var/www/456 #456.com的内容目录DirectoryIndex index.php </VirtualHost>
2. Restart Apache2
sudo service apache2 restart
Apache2 Virtual host implements one server to bind multiple domain names