比如需要建:test.com 、步骤如下
1. cd /var/www/html/
2. mkdir test
域名绑定IP
1.sudo vim /etc/hosts
2. 127.0.0.1 test.com
域名绑定站点
1.sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/test.conf
2. cd /etc/apache2/sites-available/
3. sudo vim /etc/apache2/sites-available/test.conf
4. 修改如下 :
5. ServerName test.com
6. ServerAdmin webmaster@localhost
7. DocumentRoot /var/www/html/test
切换站点
sudo a2ensite test.conf
sudo service apache2 restart