阿里云ubuntu多域名配置
1. 修改hosts
vim /etc/hosts
127.0.0.1 aaa.com www.aaa.com
127.0.0.1 bbb.com www.bbb.com
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
vim /etc/hosts
127.0.0.1 aaa.com www.aaa.com
127.0.0.1 bbb.com www.bbb.com
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