1.在C:WindowsSystem32driversetchosts里面配置:
这里写自己的域名
192.168.33.10 yuming.com
192.168.33.10 blog.com2.在ubuntu上:
cd /etc/apache2/
cd sites-available/
root@vagrant-ubuntu-trusty-64:/etc/apache2/sites-available# ls
000-default.conf api.conf groups.conf sale.conf teacher.conf123.conf default-ssl.conf operate.conf student.conf ts.conf//这里显示我的已经配置的虚拟主机
cp student.conf blog.conf
vi blog.conf
//在文件里修改内容:
//写上站点名字 ServerName blog.com //将这一行注释掉 #ServerAdmin webmaster@localhost //指向站点的php目录 DocumentRoot /vagrant/student/public
最后做一个软连接:# ln -s /etc/apache2/sites-available/blog.conf /etc/apache2/sites-enabled/
重启apache:
service apache2 restart
注;
配置apache工作目录,开启重写(在apache.conf最下面):<Directory /vagrant/>Options Indexes FollowSymLinks AllowOverride all Require all granted
</Directory>
PRp)