簡體   English   中英

您無權訪問此服務器上的文件

[英]You don't have permission to access file on this server

我有一個運行Drupal 8的Drupal服務器(UBUNTU)。 如果我將一些php文件放在我的根目錄中,則可以在瀏覽器中運行它們,但是當我將同一文件放在子目錄中時,瀏覽器發出403禁止錯誤。 我已經將權限更改為777,但無法正常工作。

有誰能夠幫助我?

“故宮

您無權訪問此服務器上的myfile。 192.168.51.60端口80上的Apache / 2.4.18(Ubuntu)服務器

我不知道服務器的設置方式以及.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]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM