ubuntu apache添加虚拟域名

1.修改hosts文件
sudo gedit /etc/hosts //修改hosts
sudo /etc/init.d/networking restart //重启网络
2.修改apache2配置文件
sudo cp 000-default.conf xx.conf //进入/etc/apache2/sites-available/中复制一份000-default.conf,命名为xx.conf。
sudo gedit xx.conf //修改xx.conf

ServerName dean.laravel.com //绑定域名,与hosts文件中一致

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/laravel/public //网站目录

3.重启apache2服务
service apache2 restart

你可能感兴趣的:(Linux,PHP)