简体   繁体   English

拒绝访问htaccess在本地而不是远程工作的目录中的文件

[英]deny access to file in a directory with htaccess working locally not remotely

I want to deny remote access to files in a directory on my web server. 我想拒绝对Web服务器目录中文件的远程访问。 I've set up a simple .htaccess file that works nicely on my local server (Windows based) 我已经设置了一个简单的.htaccess文件,该文件可以在本地服务器(基于Windows)上正常运行

Order Deny,Allow
Deny from all

But when i load the file on my remote server (Apache 2.4 on a AMI machine, a Red Hat based server) the directive is simply ignored. 但是,当我在远程服务器(AMI计算机上的Apache 2.4,基于Red Hat的服务器)上加载文件时,该指令将被忽略。

What are the possible reasons of this behaviour? 这种行为的可能原因是什么? If I'm not wrong it's not important the apache conf file as the .htaccess file in the directory should overwrite it. 如果我没记错的话,apache conf文件并不重要,因为目录中的.htaccess文件应该将其覆盖。

Could be a problem of ownership of file? 可能是文件所有权问题? I uploaded it via ftp so it's a ec2-user file, while others are apache. 我是通过ftp上传的,因此它是ec2-user文件,而其他文件则是apache。 No problem with php files loaded in the same way though. php文件以相同的方式加载没问题。

I tried also to restart apache, without success. 我也尝试重新启动apache,但没有成功。

网络服务器不允许目录使用AllowOverride ,因此.htaccess被忽略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM