简体   繁体   English

如何使用.htaccess拒绝主机发布到我的服务器

[英]How to deny a host posting to my server with .htaccess

I have a host posting using curl to my server where I held posted info. 我有一个主机使用curl张贴到我保存张贴信息的服务器上。

now this is the host drops.gamekey.sa.com 现在这是主机的drops.gamekey.sa.com

I tried this 我试过了

Order Deny,Allow
Deny from drops.gamekey.com

And this 和这个

Order Deny,Allow
Deny from gamekey.sa.com

And this 和这个

Order Deny,Allow
Deny from 192.185.48.181

nothing seems to work, and I did this to check if it is working, 似乎没有任何效果,我这样做是为了检查它是否有效,

Order Deny,Allow
Deny from all

And it works. 而且有效。 But what is the point of denying all. 但是否认一切的意义何在。 I want this specific website. 我想要这个特定的网站。

this website gamekey.sa.com is hosted at hostgator.com if that any relevant to the subject. 如果与此主题相关,则此网站gamekey.sa.com托管在hostgator.com上。

What is your Allow directive? 您的Allow指令是什么?

If Allow from all , when using Order Deny,Allow , any host will also match the Allow from all directive and will be allowed, as stated in Apache's manual: 如果使用Allow from all Deny,Allow ,当使用Order Deny,Allow ,任何主机也将匹配“ Allow from all指令,并且将被允许,如Apache手册中所述:

Deny,Allow First, all Deny directives are evaluated; Deny,Allow首先,将评估所有Deny指令; if any match, the request is denied unless it also matches an Allow directive. 如果有匹配项,则该请求将被拒绝,除非它也与Allow指令匹配。 Any requests which do not match any Allow or Deny directives are permitted. 任何与任何Allow或Deny指令都不匹配的请求都是允许的。

That's why I would rather use the Allow,Deny order in this way: 这就是为什么我宁愿以这种方式使用Allow,Deny顺序:

Order Allow,Deny
Allow from all
Deny from 192.185.48.181

Allow,Deny First, all Allow directives are evaluated; 允许,拒绝首先,所有的允许指令被评估; at least one must match, or the request is rejected. 至少一个必须匹配,否则请求被拒绝。 Next, all Deny directives are evaluated. 接下来,将评估所有“拒绝”指令。 If any matches, the request is rejected. 如果有匹配项,则请求被拒绝。 Last, any requests which do not match an Allow or a Deny directive are denied by default. 最后,默认情况下会拒绝所有与Allow或Deny指令不匹配的请求。

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

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