如何在Apache上配置以防止恶意域名解析并禁止直接通过IP访问网站?

如何在Apache上配置以防止恶意域名解析并禁止直接通过IP访问网站?

展开
收起
邂逅青青 2024-08-15 16:24:40 250 发布于浙江 分享
分享
版权
举报
1 条回答
写回答
取消 提交回答
  • 为了防止恶意域名绑定到自己的服务器ip上以及直接通过ip访问方式访问。我们可以通过apache配置可以实现这一目的,具体操作步骤如下。

    第一步,httpd.conf配置设置
    启用虚拟主机、ssl、重写模块
    LoadModule vhost_alias_module modules/mod_vhost_alias.so
    LoadModule rewrite_module modules/mod_rewrite.so
    LoadModule ssl_module modules/mod_ssl.so
    禁用根目录访问


    AllowOverride None
    Require all denied

    允许htdocs目录访问
    DocumentRoot "/usr/local/httpd/htdocs"

    #
    # 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 Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    # AllowOverride FileInfo AuthConfig Limit
    #

    # cache


    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all denied

    image.png
    参考文档https://blog.csdn.net/zouqingfang/article/details/52366399

    2024-08-30 09:24:08 举报
    赞同 评论

    评论

    全部评论 (0)

    登录后可评论

阿里云云解析DNS产品相关资讯

还有其他疑问?
咨询AI助理
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等