gpt4 book ai didi

mysql - 限制仅在服务器中访问本地地址

转载 作者:行者123 更新时间:2023-11-29 10:11:45 28 4
gpt4 key购买 nike

我的服务器中有多个Web应用程序系统,可以使用 122.0.0.1 通过互联网访问。我只想使用 192.0.0.0 在没有互联网连接的情况下仅在 localhost/network 中访问一个系统。

示例:122.0.0.0/abc122.0.0.0/定义122.0.0.0/ghi可以通过互联网访问。但我不想访问122.0.0.0/abc 通过互联网。我想通过局域网使用196.0.0.0/abc在线访问它。

这可能吗?那怎么办?

谢谢。

最佳答案

在您的 .htaccess 文件中,您可以添加以下行以仅允许特定的 IP 地址:

Order Deny,Allow
Deny from all
Allow from YourIPAdress

您也可以使用此方法,将其包含在您的 .htaccess 或虚拟主机配置文件中:

此处提到:https://stackoverflow.com/a/23325758/1993548

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REMOTE_ADDR} xxx\.xxx\.xxx\.xxx [OR]
RewriteCond %{REMOTE_ADDR} xxx\.xxx\.xxx\.xxy [OR]
RewriteCond %{REMOTE_ADDR} xxx\.xxx\.xxx\.xxz
RewriteRule .* - [L] #do notthing

#if we are here, the IP is not in the allowed list, redirect
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /maintenance.html [R=302,L]
</IfModule>

关于mysql - 限制仅在服务器中访问本地地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50848969/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com