[英]PHPS source file - 403 Forbidden You don't have permission to access this resource
嗨,我正在尝试在 Ubuntu 20.04.3 Apache 2.4.41 PHP 7 服务器上查看 .PHPS 源文件,但是当我在浏览器中查看 .phps 文件时,我收到此消息 -
403 Forbidden 您无权访问该资源。
如果我将文件类型重命名为 .txt,我可以在浏览器中很好地查看文件。
我已将以下内容添加到 .htaccess -
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source]
我尝试将其添加到/etc/apache2/sites-enabled/demo.testsite.com-le-ssl.conf但它没有用。
然后我更新了这个文件/etc/apache2/mods-available/php7.3.conf并注释掉Require all denied并添加Order Deny、Allow和Deny from all -
<FilesMatch ".+\.phps$">
SetHandler application/x-httpd-php-source
# Deny access to raw php sources by default
# To re-enable it's recommended to enable access to the files
# only in specific virtual host or directory
#Require all denied
Order Deny,Allow
Deny from all
</FilesMatch>
然后我重新启动了 apache sudo service apache2 restart并且在查看 PHPS 文件时我仍然在浏览器中收到此消息 -
403 Forbidden 您无权访问该资源。
有没有人知道如何解决?
Apache 2.4 已弃用Allow,Deny
语法。 代替
Order Deny,Allow
Deny from all
和
Require all granted
然后重新启动Apache。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.