ubuntu下xampp配置虚拟主机
现在/opt/lampp/htdocs下面建一个目录test test里面建一个文件test.html,文件里面随便打些字作为一会我们验证成功的依据。sudo gedit /opt/lampp/etc/httpd.conf
搜索vhost找到下面这句话#Include etc/extra/httpd-vhosts.conf 把前面的#号删除Include etc/extra/httpd-vhosts.conf 保存 关闭sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
把没有用的用#号注释掉<VirtualHost 127.0.0.2:80> # ServerAdmin webmaster@test.com DocumentRoot /opt/lampp/htdocs/test ServerName test.com # ServerAlias www.test.com # ErrorLog logs/test.com-error_log # CustomLog logs/test.com-access_log common </VirtualHost>sudo gedit /etc/hosts
在文件里加上一句127.0.0.2 test.com 保存 关闭重启lampp
sudo /opt/lampp/lampp restart在浏览器访问test.com