Windows – 在虚拟主机中创建别名目录
我在查询 here,here,here,here和 here之前,先询问这个问题.我猜我的搜索技能很弱. 我使用的是WampServer版本2.2e.我有需要,我需要一个虚拟主机内的虚拟路径.让我说两个主人,我有. 主虚拟主机(Localhost) NameVirtualHost *:80 <VirtualHost *:80> ServerName localhost DocumentRoot "C:/Wamp/www" </VirtualHost> 我的Apps虚拟主机 <VirtualHost *:80> ServerName apps.ptrl DocumentRoot "C:/Wamp/vhosts/ptrl/apps" ErrorLog "logs/apps-ptrl-error.log" CustomLog "logs/apps-ptrl-access.log" common <Directory "C:/Wamp/vhosts/ptrl/apps"> allow from all order allow,deny AllowOverride All </Directory> DirectoryIndex index.html index.htm index.php </VirtualHost> 我的博客虚拟主机 <VirtualHost *:80> ServerName blog.praveen-kumar.ptrl DocumentRoot "C:/Wamp/vhosts/ptrl/praveen-kumar/blog" ErrorLog "logs/praveen-kumar-ptrl-error.log" CustomLog "logs/praveen-kumar-ptrl-access.log" common <Directory "C:/Wamp/vhosts/ptrl/praveen-kumar/blog"> allow from all order allow,deny AllowOverride All </Directory> DirectoryIndex index.html index.htm index.php </VirtualHost> 我现在的要求是让http://apps.ptrl/blog/和http://blog.praveen-kumar.ptrl/应该是同一个目录.我想到的一件事是将应用文件夹中的博客文件夹移动,但是它与Git和其他东西连接在一起,因此不可能移动文件夹. 所以,我想通过这种方式创建VirtualHost的别名: <VirtualHost *:80> ServerName apps.ptrl DocumentRoot "C:/Wamp/vhosts/ptrl/apps" ErrorLog "logs/apps-ptrl-error.log" CustomLog "logs/apps-ptrl-access.log" common <Directory "C:/Wamp/vhosts/ptrl/apps"> allow from all order allow,deny AllowOverride All </Directory> DirectoryIndex index.html index.htm index.php # The alias to the blog! Alias /blog "C:/Wamp/vhosts/ptrl/praveen-kumar/blog" <Directory "C:/Wamp/vhosts/ptrl/praveen-kumar/blog"> allow from all order allow,deny AllowOverride All </Directory> </VirtualHost> 但是当我尝试访问http://apps.ptrl/blog时,我收到一个错误403禁止页面. 我做正确的事吗?如果您需要查看访问日志和错误日志,那么它们在这里: # Access Log 127.0.0.1 - - [14/Oct/2012:09:53:11 +0530] "GET /blog HTTP/1.1" 403 206 127.0.0.1 - - [14/Oct/2012:09:53:11 +0530] "GET /favicon.ico HTTP/1.1" 404 209 127.0.0.1 - - [14/Oct/2012:09:53:53 +0530] "GET / HTTP/1.1" 200 6935 127.0.0.1 - - [14/Oct/2012:09:53:53 +0530] "GET /app/blog/thumb.png HTTP/1.1" 404 216 # Error Log [Sun Oct 14 09:53:11 2012] [error] [client 127.0.0.1] client denied by server configuration: C:/Wamp/vhosts/ptrl/praveen-kumar/blog [Sun Oct 14 09:53:11 2012] [error] [client 127.0.0.1] File does not exist: C:/Wamp/vhosts/ptrl/apps/favicon.ico [Sun Oct 14 09:53:53 2012] [error] [client 127.0.0.1] File does not exist: C:/Wamp/vhosts/ptrl/apps/app/blog,referer: http://apps.ptrl/ 等待着一些帮助.如果需要,我准备提供更多的信息. 更新#1:根据felipsmartins给出的说明更改了VirtualHosts声明: <VirtualHost *:80> ServerName apps.ptrl DocumentRoot "C:/Wamp/vhosts/ptrl/apps" ErrorLog "logs/apps-ptrl-error.log" CustomLog "logs/apps-ptrl-access.log" common # The alias to the blog! Alias /blog "C:/Wamp/vhosts/ptrl/praveen-kumar/blog" <Directory "C:/Wamp/vhosts/ptrl/praveen-kumar/blog"> allow from all order allow,deny AllowOverride All </Directory> <Directory "C:/Wamp/vhosts/ptrl/apps"> allow from all order allow,deny AllowOverride All </Directory> DirectoryIndex index.html index.htm index.php </VirtualHost> 更新#2:另一个问题: 我可以访问该网站.物理链接现在正在工作.即,我可以打开http://apps.ptrl/blog/index.php,但不能http://apps.ptrl/blog/view-1.ptf,它被转换为http://apps.ptrl/ ?博客/ index.php页面=视图和ID = 1.任何解决方案? 请注意,如果要在 DocumentRoot之外的目录中创建 Alias,则可能需要明确允许访问目标目录:<VirtualHost *:80> ServerName apps.ptrl DocumentRoot "C:/Wamp/vhosts/ptrl/apps" ErrorLog "logs/apps-ptrl-error.log" CustomLog "logs/apps-ptrl-access.log" common # Puts here,before Directory directive :) Alias /blog "C:/Wamp/vhosts/ptrl/praveen-kumar/blog" <Directory "C:/Wamp/vhosts/ptrl/apps"> allow from all order allow,deny AllowOverride All </Directory> </VirtualHost> 还要注意,即使对不区分大小写的文件系统,URL路径(第一个别名部分)也是区分大小写的. 另外,从C:/ Wamp / vhosts / ptrl / praveen-kumar / blog目录检查权限. 参考 > Apache Module mod_alias (编辑:站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 程序无法启动,因为您的计算机中缺少MSVCR71.dll.尝试重新安
- Win10系统下电脑使用全民WiFi提醒wifi创建失败怎么办
- 如何防止Windows 10 Edge浏览器保存信用卡数据
- windows – 全自动软件部署和更新系统
- powershell – 我的服务帐户需要什么来解决robocopy中的“管
- active-directory – 如果DC处于脱机状态,Windows域客户端的
- 程序员快速提升:精通Zookeeper的经典应用场景
- windows – 如何提取此文件夹子目录中的所有存档?
- Win10正式版怎么免费激活 Win10正式版免费激活的方法
- windows – 当CPU百分比达到X时如何启动程序
- windows-server-2012 – Solidworks:此虚拟环境
- 微软Win11将带来CPU和内存优化 运行多个应用节省
- Windows服务 – 无法在WiX安装程序中安装和启动W
- windows – 重新安装Ubuntu 9.04时如何保存设置?
- 为什么ssh-host-config在Windows 8.1上的Cygwin中
- win10打印机不能扫描文件处理方法
- windows-server-2012-r2 – 无法激活Windows Ser
- 用于QA测试的Windows桌面(XP,Vista或Win7)EC2 AM
- active-directory – 在Windows域环境中使用Fire
- 如何最好地调整Windows开发机器?