我有一个运行Drupal 8的Drupal-server(UBUNTU)。如果我在我的根目录中放置一些php文件,我可以在我的浏览器中运行它们但是当我将相同的文件放在子目录中时,浏览器给出了403 Forbidden-error。 我已将权限更改为777,但它无法正常工作。
有人能帮助我吗?
"禁止
您无权访问此服务器上的myfile。 Apache / 2.4.18(Ubuntu)服务器位于192.168.51.60端口80"
答案 0 :(得分:0)
我不知道您的服务器是如何设置的,以及.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]