通过 VPN 将 PHP 应用程序连接到 MSSQL 时应该考虑什么?

发布于 2024-10-07 23:15:11 字数 519 浏览 0 评论 0原文

所以到目前为止我的理解是:

  1. 在我的 Centos 服务器上安装 CLI VPN 客户端 打开
  2. 与远程 IIS 服务器的 VPN 连接
  3. 正常连接到 PHP 中的 MSSQL

我担心

  1. 延迟:我应该期望多少?变化会很大吗?它会“破坏我的应用程序”吗?
  2. 关闭连接:我应该期望我的连接保持打开状态吗?在 PHP 中重新打开它是否足够简单/足够快?
  3. VPN 客户端配置:这会非常困难吗?除了打开端口之外,是否还需要更改更多服务器设置?
  4. 在 PHP 中连接到数据库:由于是通过 VPN 进行的,所以我必须采取特殊步骤吗?

其他信息:此连接仅由网站上的一项功能使用(查找本地代理),我预计普通用户每次访问使用该功能的次数不会超过 1-2 次。

也许作为维基百科更好;我还没有找到关于这个主题的好文章,而且我得到的关于通过 VPN 运行 webapp 数据库连接的反馈显然是混杂的。有这方面经验的人可以给我一些建议吗?

So my understanding so far is:

  1. Install CLI VPN client on my Centos server
  2. Open VPN connection to remote IIS server
  3. Connect to MSSQL in PHP as normal

I'm concerned about

  1. Latency: How much should I expect? Will it vary wildly? Will it "break my application"?
  2. Closed connection: Should I expect my connection to just stay open? Is reopening it in PHP trivial/fast enough?
  3. VPN client configuration: Is this going to extremely difficult? Are there more server settings that need changing besides opening a port?
  4. Connecting to DB in PHP: Are there special steps I must take because it's over a VPN?

Other info: this connection is only used by ONE feature on the site (find a local agent) and I don't expect an average user to use that feature more than 1-2 times per visit.

Perhaps this is better as a wiki; I have not found a good article on this subject and the feedback I've gotten about running a webapp DB connection over VPN has been decidedly mixed. Could someone with experience in this task give me some advice?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡淡的优雅 2024-10-14 23:15:11

你还有其他方法可以做到吗?也许是 SSL?尽管如此,我对这个问题的看法。

延迟:我应该期望多少?变化会很大吗?它会“破坏我的应用程序”吗?

取决于连接本身和一些各种因素。例如,我们的两个办公室之间有一个 24/7 运行的 OpenVPN 连接,即使在高峰期间(P2P 流量很大,别问:),连接也很稳定,没有观察到太多延迟。我们不时遇到的唯一问题是 ISP 问题。当一侧倒下时,一侧的工作就会停止。您需要考虑到这一点并实施某种故障安全机制。如果没有,您的应用程序将“崩溃”。

关闭连接:我应该期望我的连接保持打开状态吗?在 PHP 中重新打开它是否简单/足够快?

我不建议使用 PHP 应用程序处理 VPN 连接,它应该专注于确保业务逻辑正常工作,并将所有连接处理留在网络/服务器上。如果您要将所有这些逻辑放入应用程序中,并且如果 VPN 连接发生变化,您将需要重写它。你可以说我懒惰,但我喜欢抽象:)

VPN 客户端配置:这会非常困难吗?除了打开端口之外,是否还需要更改更多服务器设置?

很难回答这个问题,因为没有有关所使用的 VPN 客户端/服务器的信息,也没有任何 VPN 服务器配置的信息。它可以像打开端口一样简单,也可以像在没有任何事先练习的情况下跑马拉松一样困难。

在 PHP 中连接到数据库:由于是通过 VPN 进行的,所以我必须采取特殊步骤吗?

您不应该,只需确保连接后即可访问数据库即可。你会亲

Is there any other way you could do it? SSL perhaps? Nevertheless, my view on the subject.

Latency: How much should I expect? Will it vary wildly? Will it "break my application"?

Depends on the connection itself and some various factors. For example, we have an OpenVPN connection between our two offices running 24/7, even during high peaks (heavy P2P traffic, don't ask :) the connection is stable and not much latency is observed. The only problem we are experiencing from time to time are ISP issues. When one goes down, work stops for one side. You need to take it into account and implement some sort of fail safe mechanism. If not, your application will "break".

Closed connection: Should I expect my connection to just stay open? Is reopening it in PHP trivial/fast enough?

I don't recommend PHP application handling VPN connection, it should focus on making sure business logic works properly and leave all connection handling on the networking/server. If you are to put all this logic into application and if VPN connection changes, you will need to rewrite it. Call me lazy, but I like abstraction :)

VPN client configuration: Is this going to extremely difficult? Are there more server settings that need changing besides opening a port?

Hard to answer this one as there is no information on the VPN client/server used, nor any VPN server configuration. It can be as easy as opening the port or as hard as running a marathon without any prior practice.

Connecting to DB in PHP: Are there special steps I must take because it's over a VPN?

You shouldn't, just make sure DB is accessible once connected. You will pro

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文