php代理到本地mercurial服务器

发布于 2024-08-27 04:57:35 字数 281 浏览 7 评论 0原文

我想知道是否可以为本地监听 onlu 的服务器创建一个 php 代理,以便 php 网关是公共的,并将所有内容定向到监听本地主机的服务器。

该服务器将是 Mercurial 的 hg 服务,仅侦听 127.0.0.1,并且 php 将执行身份验证。

你认为这可能吗?有人知道如何在 php 中制作通用代理,以便不仅可以使用 http get,还可以使用 hg Push?

我知道有一些方法可以通过身份验证来托管 Mercurial 存储库,但它位于插头计算机上,我没有足够的空间来容纳更多应用程序等。

I was wondering is it possible to create a php proxy to a server that listens onlu locally so that the php gateway is public and it directs everything to the server listening on localhost.

This server would be mercurial's hg serve that listens only on 127.0.0.1 and php will do the authentication.

Do You think it's possible to do? Anybody has an idea how to make a general proxy in php so that not only http get works, but also hg push?

I know there are ways to host mercurial repo with auth, but it's on a plug computer and I don't have a lot of space for more apps etc.

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

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

发布评论

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

评论(3

黎夕旧梦 2024-09-03 04:57:35

您不需要运行 hgserve

请改用 hgweb.cgihgwebdir.cgi。这些是可以在 Apache 下运行的标准 CGI 脚本。 hgweb.cgi 服务于单个存储库,hgwebdir.cgi 服务于多个存储库。它们不需要在 Apache 上安装任何特殊模块,并且您可以使用 Apache 的所有内置访问控制和身份验证机制。

最好的参考是 Mercurial wiki 上的 PublishingRepositories,它解释了如何执行此操作并比较了其他选项,包括 ssh,这需要更少的设置。

You don’t need to run hg serve.

Instead, use hgweb.cgi or hgwebdir.cgi. These are standard CGI scripts that can be run under Apache. hgweb.cgi serves a single repository, and hgwebdir.cgi serves multiple repositories. They do not require any special modules to be installed on Apache, and you can use all of Apache’s built-in access-control and authentication mechanisms.

The best reference is PublishingRepositories on the Mercurial wiki, which explains how to do this and also compares other options, including ssh, which requires even less setup.

始于初秋 2024-09-03 04:57:35

如果您确实想使用 PHP,您可以使用套接字功能来完成您想要的任何网络操作。 (http://ch.php.net/manual/en/ref.sockets .php)并且您可以使用 fsockopen 连接到您想要的任何内容。您可以将其组合起来并在通过控制台运行的 PHP 脚本中使用它。重复使用 set_time_limit 来保持代理运行。你需要大量的知识和运气才能完成这件事。

但实际上你正在做的事情真的很奇怪(请参阅其他答案和评论)。无论您出于何种原因进行此配置,它都是错误的。

If you really want to use PHP, you could use the socket functionalities to do whatever networking you want. (http://ch.php.net/manual/en/ref.sockets.php) And you can use fsockopen to connect to whatever you want. You could combine this and use it in a PHP script which you run by console. Use set_time_limit repeatedly to keep your proxy running. You'll need a lot of knowledge and luck to get this done.

But actually it's really WEIRD what you're doing (see other answers and comments). Whatever reason you have for this configuration, it's wrong.

や莫失莫忘 2024-09-03 04:57:35

如果您在 apache 中运行 php,那么您可能可以使用 php 做您想做的事情。只需将 apache 配置为代理 hgserve(假设您无法运行 wsgi 或 cgi,这是更好的解决方案),然后就可以了。我认为在 PHP 领域,apache 和 hgserve 没有提供任何可以添加的内容。

但是,是的,您可以在 PHP 中重新实现 Apache 的代理功能,尽管您还需要确保包含对 RangeRequests 的支持,mercurial 在某些情况下会使用 RangeRequests。为了提高效率,不要忘记 RFC2616 缓存逻辑(If- headers、Cache-Control、Expires、Last-Modified 等)...

If you're running your php in apache, then you can probably do what you want with php. Just configure apache to proxy to hgserve (assuming you can't run wsgi or cgi, which is the better solution) and you're set. I don't think there's anything to add in PHP land that apache and hgserve don't already bring to the table.

But, yes, you could reimplemnt Apache's proxy functionality in PHP, though you'll also need to make sure to include support for RangeRequests, which mercurial uses in some situations. Don't forget your RFC2616 caching logic (If- headers, Cache-Control, Expires, Last-Modified, etc.) for efficiency...

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