2017-03-20 233 views
0

我有一臺運行Drupal 8的Drupal服務器(UBUNTU)。如果我將一些php文件放在我的根目錄中,我可以在瀏覽器中運行它們,但是當我將同一個文件放在子目錄中時,瀏覽器會出現403 Forbidden錯誤。 我已經將權限更改爲777,但它不起作用。您沒有權限訪問此服務器上的文件

任何人都可以幫助我嗎?

「故宮

您沒有權限訪問此服務器上的文件MyFile。 的Apache/2.4.18(Ubuntu的)服務器在192.168.51.60端口80」

+0

嘗試允許訪問所有父迪爾斯以及所有到Web根目錄。 – MilanG

回答

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] 
相關問題