三叶草 发表于 2021-10-2 10:40:04

修改hosts文件使apache绑定域名指向本机

apache下绑定域名
方法如下:
1、找到apache安装目录下的httpd.conf并打开,在最后加上:

NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot C:/AppServ/www
</VirtualHost>
<VirtualHost *:80>
ServerName saas.amy.net
DocumentRoot C:/AppServ/www/myproject/saas
</VirtualHost>
<VirtualHost *:80>
ServerName admin.amy.net
DocumentRoot C:/AppServ/www/myproject/admin
</VirtualHost>
2、找到C:/Windows/System32/drivers/etc下的hosts文件并打开,在最后加上:

127.0.0.1       localhost
127.0.0.1       saas.amy.net
127.0.0.1       admin.amy.net
3、重启apache服务。搞定

https://www.uoften.com/serverhost/winhost/20180415/80887.html
页: [1]
查看完整版本: 修改hosts文件使apache绑定域名指向本机