无法向我的 apache2 服务器添加别名

无法向我的 apache2 服务器添加别名

我想/home/ut/programmes/Programmation/p5-linux/Projets/localhost/p5.js

通过以下配置/etc/apache2/sites-available/000-default.conf(在<VirtualHost *:80>标记中):

Alias "/p5.js" "/home/ut/programmes/Programmation/p5-linux/Projets"
<Directory "/home/ut/programmes/Programmation/p5-linux/Projets">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

http://localhost/p5.js返回 404 未找到。

———————————————————————————————————————————————————————————

编辑 :

删除斜线如下:

Alias /p5.js "/home/ut/programmes/Programmation/p5-linux/Projets"
<Directory "/home/ut/programmes/Programmation/p5-linux/Projets">

解决了 404 错误,但现在我收到 403 错误,而且我发现真的没有办法修复该错误。我尝试更改文件夹的权限,更改所有者,但都不起作用。

答案1

你需要改变

Alias /p5.js/ "/home/ut/programmes/Programmation/p5-linux/Projets/"

Alias "/p5.js/" "/home/ut/programmes/Programmation/p5-linux/Projets/"

或者:

Alias /p5.js/ "/home/ut/programmes/Programmation/p5-linux/Projets/"

Alias "/p5.js" "/home/ut/programmes/Programmation/p5-linux/Projets"

来源:

https://httpd.apache.org/docs/2.4/mod/mod_alias.html#alias

相关内容