保护 Rails 后端服务器免遭直接连接

发布于 2024-10-01 07:11:55 字数 168 浏览 0 评论 0原文

这是为 Rails 应用程序提供服务的经典方案:前端是 80 端口上的 Apache(nginx 等),后端:其他一些端口上的 mongrel(thin、unicorn 等)集群(例如 3000、3001、3002...) 。

如何使后端服务器允许本地(来自前端)连接?

It is classical scheme of serving Rails application: frontend is Apache (nginx, etc) on 80 port, and backend : cluster of mongrel (thin, unicorn, etc) on some other ports (for example 3000,3001,3002...).

How make, that back-end servers allow only local (from frontend) connections?

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

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

发布评论

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

评论(1

平安喜乐 2024-10-08 07:11:55

如果您使用套接字连接,那么您肯定只能在本地。

之后你可以对某些服务器说只接受 127.0.0.0 请求。通过 Thin 的示例

thin start -a 127.0.0.0

-a 选项是:

-a, --address HOST               bind to HOST address (default: 0.0.0.0)

一个好的做法是添加一些防火墙以避免任何地方到代理端口的所有连接。

If you use the connection by socket, you are sur to be only in local.

After you can say to some server to accept only 127.0.0.0 request. Byt example with thin

thin start -a 127.0.0.0

The -a options is :

-a, --address HOST               bind to HOST address (default: 0.0.0.0)

A good practice too is to add some Firewall to avoid all connection by anywhere to your proxy port.

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