当前位置: 代码迷 >> 综合 >> Apache2 virtual folder configuration
  详细解决方案

Apache2 virtual folder configuration

热度:25   发布时间:2023-12-08 01:41:21.0

  (1) 运行 sudo vi /etc/apache2/httpd.conf

(2)在httpd.conf里面加了如下语句

Alias /anstyla "E:/anstyla/src/web"
<Directory "E:/anstyla/src/web">
          Options Indexes MultiViews
          AllowOverride None
          Order allow,deny
          Allow from all
</Directory>

 

在此模块下建立虚拟目录,Alias /虚拟目录名称/ "虚拟目录路径,以[/]代替[/]"

例如:Alias /admin "D:/web/admin/"

(*)/admin 为虚拟目录名称,一般不用在名称后加"/",若加入,每次都要在虚拟目录后输入"/"才能访问网站;D:/web/admin/ 为虚拟目录的物理路径.

 

(3).重启Apache


Note: 如果要进行本地解析,请运行:sudo vi /etc/hosts

添加域名:127.0.0.1   域名
重启apache  sudo /etc/init.d/apache2 restart


以上为我个人做apache虚拟目录的配置过程

  相关解决方案