apache设置虚拟主机目录

2025-11-03 17:23:12

1、打开Apache2 安装目录下的\conf\extra\, 找到 httpd-vhosts.conf 文件加入

<VirtualHost *:80>

    DocumentRoot "D:\WWW\demo"

    ServerName demo.com

    ServerAlias 

  <Directory "D:\WWW\bsxs">

      Options FollowSymLinks ExecCGI

      AllowOverride All

      Order allow,deny

      Allow from all

      Require all granted

  </Directory>

</VirtualHost>

如图:

apache设置虚拟主机目录

2、打开 httpd.conf 文件,Include conf/extra/httpd-vhosts.conf在470行的位置去掉前面的#号,如图:

apache设置虚拟主机目录

3、最后重启apache生效。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢