MAMP Apache Alias 始终相对于文档根映射
我正在尝试在 MAMP 上的 Apache 中设置虚拟目录。
这就是我在 httpd.conf 文件中放入的内容
Alias /app /Users/ernesto/Developer/App/webroot
<Directory /Users/ernesto/Developer/App/webroot>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
MAMP 的文档根设置为默认的 /Applications/MAMP/htdocs
并且上面示例中的路径是绝对的。但是 MAMP 试图将上面的路径映射到:
/Applications/MAMP/htdocs/Users/ernesto/Developer/App/webroot
在显示 apache 错误日志的最后几行后我意识到了这一点:
[Thu Nov 17 15:40:39 2011] [error] [client 127.0.0.1] File does not exist: /Applications/MAMP/htdocs/Users
只是确定,我将上面的路径更改为以 /Uxers
开头(而不是/Users
),并且更改已反映在错误日志中。
根据我在网上研究的内容,我几乎可以肯定我所期望的是正确的行为,但显然我可能做错了什么,或者 MAMP 的 httpd.conf 中可能有其他一些模糊的设置使 apache 以这种方式工作。有什么想法吗?
I'm trying to setup a virtual directory in Apache on MAMP.
This is what I'm putting in the httpd.conf file
Alias /app /Users/ernesto/Developer/App/webroot
<Directory /Users/ernesto/Developer/App/webroot>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
MAMP's document root is set to the default /Applications/MAMP/htdocs
and the path in the example above is meant to be absolute. But MAMP is trying to map the above path to:
/Applications/MAMP/htdocs/Users/ernesto/Developer/App/webroot
I realized this after displaying the last few lines of apache's error log:
[Thu Nov 17 15:40:39 2011] [error] [client 127.0.0.1] File does not exist: /Applications/MAMP/htdocs/Users
Just ot be sure, I changes the path above to start with /Uxers
(instead of /Users
), and the change was reflected in the error log.
I'm almost sure from what I've researched online that what I expect is the correct behavior, but obviously I might be doing something wrong, or maybe there's some other obscure setting in MAMP's httpd.conf that is making apache work this way. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以..从这个SO问题我知道有同时使用 alias 和 mod_rewrite 的一些问题。这让我看到 Apache 手册的 这一部分,其中指出
:别名目录中 .htaccess 文件的重写基础解决了我的问题(这首先让我想到了你的问题)
So.. from this SO question I got that there are some issues with using both alias and mod_rewrite. Which led me to this part of the Apache manual which states:
Adding a rewrite base to the .htaccess file in the aliased directory solved my issue (which led me to your question in the first place)
我今天经历过这个。在我几乎抓狂之后(我真的必须完成一些工作),我发现 httpd-vhosts.conf 文件的包含内容在 MAMP 的默认安装中被注释掉了,因此,对我的 httpd-vhosts.conf 文件进行的(数十个)故障排除更改都没有进行:
我用力捂住脸。这类似于电视未插入电源...
I went through this today. After nearly pulling all of my hair out (I really had to get something done work work), I found out found that the include for the httpd-vhosts.conf file was commented out in MAMP's default installation, so none of the (dozens of) troubleshooting changes to my httpd-vhosts.conf file were even taking:
I facepalmed so hard. This is akin to the TV not being plugged in...