phpstudy本地搭建域名访问

 时间:2026-02-17 11:53:18

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

如图:

phpstudy本地搭建域名访问

2、打开后,在hosts文件里添加自己的域名

如图:

phpstudy本地搭建域名访问

3、再进入apache下的安装目录D:\phpStudy\Apache\conf,打开httpd.conf文件

,去掉Include conf/extra/httpd-vhosts.conf前面的#

如图:

phpstudy本地搭建域名访问

4、再进入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>

  • 用自己的电脑做服务器搭建网站并让互联网访问
  • 网站制作自定义404页面教程
  • windows2003系统安装IIS和windows自带的FTP
  • wordpress网站如何给自己账号添加用户头像
  • 宝塔远程桌面助手使用教程
  • 热门搜索
    火锅汤底的做法 清蒸鲈鱼做法 梅菜肉饼的做法 正宗酸菜鱼的做法 黑头怎么去除最有效 人类是怎么来的 怎么查询社保缴费记录 姜枣茶的做法 蒸面包怎么做家庭做法 豌豆面的做法大全