如何configurationApache只显示访问者的IP是一个指定的?

我只想显示自己的内容,我如何configurationApache?

我正在使用代理来访问该网站。

我无法做到这一点iptables为特权的原因..

你有代理的访问权限? 如果是这样,请启用X-FORWARDED-FOR并configurationApache,如下所示:

 SetEnvIf X-Forwarded-For ^your\.real\.IP\.address let_me_in Order allow,deny allow from env=let_me_in ErrorDocument 403 http://google.com 

查询string中只有一个单位= 1时,我如何允许访问?

你可以使用mod_rewrite来做到这一点:

 RewriteCond %{QUERY_STRING} !^(.*)flat=1(.*)$ [NC] RewriteRule ^(.*)$ - [F,NC] 
 Order Deny,Allow Deny from all Allow from xxxx 

这将阻止访问除指定的地址以外的所有地址。 把它放在你的<VirtualHost>块,或.htaccess文件,或者一个<Directory>或者<Location>块中。

看到这个链接: http : //httpd.apache.org/docs/2.0/howto/auth.html – 并使用任何你想要的两种方法。 甚至两者。

鉴于您身在代理之后,只需密码保护您的网站可能会更容易。

DocumentRoot目录中创build一个名为.htaccessDocumentRoot然后添加(如果它已经存在,那么只需添加它)

 AuthUserFile /path/to/.htpasswd AuthName "Secret Squirrel" AuthType Basic Require Valid-User 

改变/path/以上,以适合你的东西。

然后创build文件/path/to/.htpasswd并添加一个用户名和密码

 htpasswd -c /path/to/.htpasswd user 

这将创build该文件并添加一个用户名user并要求input密码。 现在您的网站受密码保护。