本地apache设置虚拟域名

版权声明:本文出自mqy1023的博客,转载必须注明出处。 https://blog.csdn.net/mqy1023/article/details/80616060

最近不管是玩wordpress/opencart二次开发还是本地调试后端项目,都用到了虚拟域名的功能,虽网上本地apache设置虚拟域名 类似文章还多,记录下自己的还是不错的

www.test.com => 打开本地xampp 中的abc项目 为例子
1、打开xampp文件夹, 打开...\xampp\apache\conf\extrahttpd.conf , 去掉httpd-vhosts.conf 前的#号注释

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

2、打开:...\xampp\apache\conf\extra;找到httpd-vhosts.conf

<VirtualHost *:80>
    ServerAdmin www.test.com
    DocumentRoot "D:/xampp/htdocs/abc"
    ServerName www.test.com
    ErrorLog "logs/www.test.com-error.log"
    CustomLog "logs/www.test.com-access.log" common
</VirtualHost>

3、打开C盘,按路径C:\Windows\System32\drivers\etc找到hosts文件添加一行

127.0.0.1 www.test.com
参考链接

本地apache设置虚拟域名

猜你喜欢

转载自blog.csdn.net/mqy1023/article/details/80616060
今日推荐