Apache2的别名不Ubuntu的工作吗? [英] Apache2 Alias not working in Ubuntu?

查看:232
本文介绍了Apache2的别名不Ubuntu的工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚才已经安装的Apache / PHP /在Ubuntu 12.04 mysql的,我已经创造了我的虚拟目录的别名,这里是我的/ etc / apache2的/ / 000-默认文件中启用的站点 -

I've just setup apache/php/mysql in Ubuntu 12.04, and I've created an Alias for my virtual directory, here's my /etc/apache2/sites-enabled/000-default file:

Alias /demo/ "/home/czetsuya/projects/eclipse/eclipse-php/demo-portfolio"
<Directory "/home/czetsuya/projects/eclipse/eclipse-php/demo-portfolio">
    DirectoryIndex index.php
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
    Allow from all
</Directory>

请注意,我已经申请chown和chmod命令:/家庭/ czetsuya /项目/日食/月食的PHP /演示组合

Note that I've already applied chown and chmod to: /home/czetsuya/projects/eclipse/eclipse-php/demo-portfolio

chown www-data:www-data /home/czetsuya/projects/eclipse/eclipse-php/demo-portfolio -R
chmow 777 /home/czetsuya/projects/eclipse/eclipse-php/demo-portfolio -R

但是,当我访问:_http://本地主机/演示,我得到了一个404未找​​到错误。看着/var/log/apache2/error.log我发现它仍然位于/ var / WWW /演示指点:

But when I access: _http://localhost/demo, I got a 404 Not found error. Looking at /var/log/apache2/error.log I found that it's still pointing at /var/www/demo:

File does not exist: /var/www/demo

任何想法,为什么别名被忽略?

Any idea why Alias is ignored?

请注意,我已经重新启动并重新加载的Apache2。并重写也被激活。

Note that I already restart and reload apache2. And rewrite is also enabled.

谢谢,

czetsuya

Thanks,
czetsuya

推荐答案

您的问题可以很可能由的 mod_alias中手动;

Your problem can most likely be solved by the mod_alias manual;

请注意,如果你有一个尾随/的URL路径上,则服务器
  将需要一个尾随/以扩大的别名。也就是说,如果
  您使用

Note that if you include a trailing / on the URL-path then the server will require a trailing / in order to expand the alias. That is, if you use

别名/图标/在/ usr /本地/ Apache /图标/那么URL /图标不会
  别名,因为它缺乏尾随/.

Alias /icons/ /usr/local/apache/icons/ then the URL /icons will not be aliased, as it lacks that trailing /.

试着改变 /演示/ /演示在你的别名,它应该更好地工作。

Try changing /demo/ to /demo in your alias, and it should work better.

这篇关于Apache2的别名不Ubuntu的工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆