首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >阻止来自服务器名称的访问

阻止来自服务器名称的访问
EN

Stack Overflow用户
提问于 2020-05-29 20:49:51
回答 1查看 50关注 0票数 0

您好,我正在加固一个使用Apache作为WordPress服务器的网站。我要阻止来自servername.admin.company.com的访问。我试着根据我在这里看到的另一个答案编辑https://domainname.com,但该网站从HTACCESS开始500‘。有大量的安全问题,我们认为处理它的最好方法是完全阻止访问,因为没有人真的需要通过这种方式访问它。

这是我的vhosts文件:

代码语言:javascript
运行
复制
'  <Directory "/var/www/directory">
    AllowOverride All
    Options -Indexes +FollowSymLinks
    Require all granted
    Require not host servername.admin.company.com
  </Directory>
DirectoryIndex index.php index.html


<VirtualHost *:80>
  ServerName site.com
  ServerAlias www.site.com

  DocumentRoot "/var/www/directory"

  # Enable HSTS (tell browsers to use only HTTP)
  Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload;"

  <Directory "/var/www/html">
    AllowOverride All
    Options -Indexes +FollowSymLinks
    Require all granted
  </Directory>

  RewriteEngine on
  RewriteRule "^(.*/)?\.git/" - [F,L]
  RedirectMatch 404 /\.git

</VirtualHost>



<VirtualHost *:80>
  ServerName business.site.com
  ServerAlias subdomain.site.com
 ServerAlias www.business.site.com

  DocumentRoot "/var/www/directory"

  # Enable HSTS (tell browsers to use only HTTP)
  Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload;"

  <Directory "/var/www/site">
    AllowOverride All
    Options -Indexes +FollowSymLinks
    Require all granted
  </Directory>

  RewriteEngine on
  RewriteRule "^(.*/)?\.git/" - [F,L]
  RedirectMatch 404 /\.git

  CustomLog /var/log/httpd/site-requests.log combined
</VirtualHost>



<VirtualHost *:80>
  ServerName business.site.com
  ServerAlias directory.site.com
 ServerAlias www.subfolder.site.com

  DocumentRoot "/var/www/sitefolder"

  # Enable HSTS (tell browsers to use only HTTP)
  Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload;"

  <Directory "/var/www/sitefolder">
    AllowOverride All
    Options -Indexes +FollowSymLinks
    Require all granted
  </Directory>

  RewriteEngine on
  RewriteRule "^(.*/)?\.git/" - [F,L]
  RedirectMatch 404 /\.git

  CustomLog /var/log/httpd/sitefolder-requests.log combined
  ErrorLog /var/log/httpd/sitefolder-error.log

</VirtualHost>

EN

Stack Overflow用户

发布于 2020-05-29 21:09:12

您可以通过多种方式来实现这一点,如iptables.htaccess等。

请访问这个URL,你需要做的事情在那里有很好的文档:

https://httpd.apache.org/docs/2.4/en/howto/access.html

我希望它能对你有所帮助。

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62086425

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档