apache - 不需要 ip 不会阻止 apache centos 服务器上的 IP 地址
问题描述
我试图阻止我的服务器的 IP 并阻止他们能够加载我的网站,我已将他们的 IP 添加到httpd.conf
文件中并成功重新启动 httpd,但在尝试加载网站后,我仍然能够访问该网站,我肯定不会错过一些明显的东西吗?
我究竟做错了什么?
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/MY-SITE/dist"
#
# Relax access to content within /var/www.
#
<Directory "/var/www">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
# Further relax access to the default document root:
<Directory "/var/www">
#
# 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.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks
#
# 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 All
#
# Controls who can get stuff from this server.
#
<RequireAll>
Require all granted
Require not ip X.X.X.X
</RequireAll>
# Header set Access-Control-Allow-Origin "*"
</Directory>
解决方案
在这里
<Directory "/var/www">
#
# 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.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks
#
# 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 All
#
# Controls who can get stuff from this server.
#
<RequireAll>
Require all granted
Require not ip X.X.X.X
</RequireAll>
# Header set Access-Control-Allow-Origin "*"
您需要像这样更改目录路径
<Directory "/var/www/MY-SITE/dist">
然后尝试一下。谢谢你
推荐阅读
- sql-server - 涉及 Null 和空白与填充值的复杂 SQL Server Pivot
- html - Angular 6 routerLinkActive 不起作用
- powershell - 匹配软件Powershell的脚本
- javascript - 建立一个进度表,它对齐步骤和仪表
- php - PHP:仅显示每个单词的第一个字母+包括标点符号
- html - 两个侧边栏问题
- android - Android 签名 APK 使用改造加载 json 数据
- pyqt - 无法显示 QGraphicsEllipseItem()
- acumatica - 更新 POOrderEntry 中的缓存时出现异常
- css - 为什么我的按钮不起作用?它没有点击,没有悬停......任何东西