1.我们先加入hosts
sudo vim /etc/hosts
2.修改hosts配置文件
127.0.0.1 localhost
127.0.0.1 admin.app.com
127.0.0.1 test.app.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
3.增加映射配置文件
#首先进入apache配置目录
cd /etc/apache2/sites-available
#复制一份默认配置
sudo cp 000-default.conf test.conf
4.修改配置文件
<Directory /var/www/html/test/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<VirtualHost *:80>
ServerName test.app.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/test/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
5.生成映射配置
sudo a2ensite test.conf
6.重启apache生效
sudo service apache2 reload
ubuntu 设置多站点
猜你喜欢
转载自blog.csdn.net/newfarhui/article/details/81448230
今日推荐
周排行