gpt4 book ai didi

ubuntu - 您无权访问此服务器上的文件

转载 作者:行者123 更新时间:2023-12-04 19:14:38 26 4
gpt4 key购买 nike

我有一个运行 Drupal 8 的 Drupal 服务器(UBUNTU)。如果我将一些 php 文件放在我的根目录中,我可以在浏览器中运行它们,但是当我将相同的文件放在子目录中时,浏览器会给出 403 禁止错误。
我已经将权限更改为 777,但它不起作用。

有谁能够帮我?

"Forbidden

You don't have permission to access myfile on this server. Apache/2.4.18 (Ubuntu) Server at 192.168.51.60 Port 80"

最佳答案

我不知道您的服务器是如何设置的以及 .php 文件位于哪个文件夹中,但 Drupal 安装默认包含 .htaccess 文件,该文件定义了各种规则,限制了 apache http 服务器上可以访问哪些文件和文件夹。
检查此部分的 .htaccess 文件:

# For security reasons, deny access to other PHP files on public sites.
# Note: The following URI conditions are not anchored at the start (^),
# because Drupal may be located in a subdirectory. To further improve
# security, you can replace '!/' with '!^/'.
# Allow access to PHP files in /core (like authorize.php or install.php):
RewriteCond %{REQUEST_URI} !/core/[^/]*\.php$
# Allow access to test-specific PHP files:
RewriteCond %{REQUEST_URI} !/core/modules/system/tests/https?.php
# Allow access to Statistics module's custom front controller.
# Copy and adapt this rule to directly execute PHP files in contributed or
# custom modules or to run another PHP application in the same directory.
RewriteCond %{REQUEST_URI} !/core/modules/statistics/statistics.php$
# Deny access to any other PHP files that do not match the rules above.
# Specifically, disallow autoload.php from being served directly.
RewriteRule "^(.+/.*|autoload)\.php($|/)" - [F]

关于ubuntu - 您无权访问此服务器上的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42901350/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com