1. vim /etc/hosts
//Insert添加
127.0.0.1 aaa.com www.aaa.com
127.0.0.1 bbb.com www.bbb.com
//编辑完, ESC, :wq保存退出
2.vim /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerName aaa.com ServerAlias www.aaa.com <Directory /data/www/aaa> AllowOverride All Require all granted </Directory> ServerAdmin webmaster@localhost DocumentRoot /data/www/aaa ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
cp
000-default.conf
001-default.conf
//复制作为站点b的配置
3.启动站点
sudo a2ensite 000-default.conf
sudo a2ensite 001-default.conf 4.sudo /etc/init.d/apache2 restart