简体   繁体   English

直接拒绝访问文件夹

[英]Deny access to folder directly

I have bitnami based instance with apache and php . 我有基于apachephp bitnami实例。 I want to secure the phpmyadmin folder, I have read many tutorials on internet , what I did now is that I changed the 我想保护phpmyadmin文件夹,我已经在互联网上阅读了许多教程,现在所做的是更改了

Alias /secret/ "/opt/htdocs/phpmyadmin/ " Alias /secret/ "/opt/htdocs/phpmyadmin/

and thats how I am accessing the phpymyadmin folder using mydomain.com/secret. 那就是我如何使用mydomain.com/secret访问phpymyadmin文件夹。 but still user can access the folder phpmyadmin , How can I restrict this? 但仍然用户可以访问文件夹phpmyadmin,我该如何限制呢?

Thanks 谢谢

This is because you seem to have put the phpmyadmin folder in your web root -- when using an Alias, you'll normally want to put it somewhere outside of the /opt/htdocs/ folder (anywhere, really; if it were me I'd probably just put it in /opt/phpmyadmin/ but you can put it wherever you want). 这是因为您似乎已将phpmyadmin文件夹放置在您的Web根目录中-使用别名时,通常需要将其放置在/opt/htdocs/文件夹之外的某个位置(任何地方,真的;如果是我,可能只是将其放在/opt/phpmyadmin/但您可以将其放置在任意位置。 Update your Alias to point to the correct folder. 更新您的别名以指向正确的文件夹。

Since right now you also have the phpmyadmin folder in the web root, when you try to connect to http://example.com/phpmyadmin then Apache looks in the web root and finds the matching folder. 由于现在您在Web根目录中也有phpmyadmin文件夹,因此当您尝试连接到http://example.com/phpmyadmin Apache会在Web根目录中查找并找到匹配的文件夹。 When you look for http://example.com/secret , the alias takes over, but the net result is the same either way. 当您寻找http://example.com/secret ,别名将接管,但最终结果是相同的。

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

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