限制IP访问服务器有很多的方法! 可以设置防火墙或其他的方法
下面是设置httpd 的配置文件来限制IP的访问
- <Directory "/var/www/html">
- #
- # Possible values for the Options directive are "None", "All",
- # or any combination of:
- # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
- #
- # Note that "MultiViews" must be named *explicitly* --- "Options All"
- # doesn't give it to you.
- #
- # The Options directive is both complicated and important. Please see
- # http://httpd.apache.org/docs-2.0/mod/core.html#options
- # for more information.
- #
- Options
- #
- # AllowOverride controls what directives may be placed in .htaccess files.
- # It can be "All", "None", or any combination of the keywords:
- # Options FileInfo AuthConfig Limit
- #
- AllowOverride None
- # Agregado para redirigir el http a https
- # RewriteEngine On
- # RewriteCond %{HTTPS} off
- # RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
- #
- # Controls who can get stuff from this server.
- # 设置可以访问服务器的IP
- Allow From 192.168.1.12 220.133.*.*/255.255.255.255
- Order deny,allow
- Deny from all
- </Directory>