开发者社区 > 域名解析DNS > 云解析DNS > 正文

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

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

展开
收起
邂逅青青 2024-08-15 16:24:40 74 0
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
    赞同 展开评论 打赏

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

相关产品

  • 云解析DNS
  • 相关电子书

    更多
    Apache Flink技术进阶 立即下载
    Apache Spark: Cloud and On-Prem 立即下载
    Hybrid Cloud and Apache Spark 立即下载

    相关镜像