首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >您没有访问此服务器上文件的权限

问您没有访问此服务器上文件的权限
EN

Stack Overflow用户
提问于 2017-03-20 10:35:08
回答 1查看 2.6K关注 0票数 0

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

有人能帮我吗?

“禁止 您没有权限访问此服务器上的我的文件。Apache/2.4.18 (Ubuntu)服务器,位于192.168.51.60端口80“

EN

回答 1

Stack Overflow用户

发布于 2017-03-20 11:55:34

我不知道您的服务器是如何设置的,.php文件位于哪个文件夹中,但默认情况下,Drupal安装包含.htaccess文件,该文件定义了限制在apache服务器上访问哪些文件和文件夹的各种规则。本节请查看您的.htaccess文件:

代码语言:javascript
复制
# 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]
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42901350

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档