phpstudy本地搭建域名访问

作者:分开不是尽头 | 创建时间: 2023-05-24
phpstudy本地搭建域名访问,win系统的vps同样也适用...
phpstudy本地搭建域名访问

操作方法

进入C:\Windows\System32\drivers\etc,建议使用notepad++打开hosts文件 如图:

打开后,在hosts文件里添加自己的域名 如图:

再进入apache下的安装目录D:\phpStudy\Apache\conf,打开httpd.conf文件 ,去掉Include conf/extra/httpd-vhosts.conf前面的# 如图:

再进入D:\phpStudy\Apache\conf\extra,打开httpd-vhosts.conf文件,在尾部加上 D:\phpStudy\Apache\conf\extra\httpd-vhosts.conf <VirtualHost *:80> DocumentRoot "D:/phpStudy/WWW" ServerName localhost </VirtualHost> <VirtualHost *:80> #这里说明在D:/phpStudy/WWW/下要有一个a文件夹,源代码放a文件夹里,绑上了hosts文件里设置的a.com DocumentRoot "D:/phpStudy/WWW/a" ServerName a.com </VirtualHost> <VirtualHost *:80> DocumentRoot "D:/phpStudy/WWW/a" ServerName www.a.com </VirtualHost>

点击展开全文

更多推荐