首页 文章

Apache反向代理Unix套接字

提问于
浏览
2

我正在尝试使用unix套接字将Apache 2.4.7中的ProxyPass设置为用于rails应用程序的puma服务器 . 我一直收到500内部错误 . 当我检查apache日志时,我收到以下消息:

No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

这是我在apache中的代理配置

ProxyPass / unix:///home/rails/rp/tmp/sockets/puma.sock|http://127.0.0.1/
ProxyPassReverse / unix:///home/rails/rp/tmp/sockets/puma.sock|http://127.0.0.1/

如果我在这样的常规tcp端口上设置代理通行证,它可以正常工作 .

ProxyPass / http://127.0.0.1:9292
ProxyPassReverse / http://127.0.0.1:9292

如有任何帮助,请告知我们您是否需要更多信息 .

2 回答

  • 0

    我不确定哪个代理处理程序应该处理套接字,所以你可以尝试加载它们然后看看哪个为你完成了这个工作:

    https://httpd.apache.org/docs/trunk/mod/mod_proxy.html

    请注意,您还可以使用SetHandler指定要处理连接的模块

  • 0

    好的,我花了一段时间在我的旧服务器上找到解决方案 .

    当你有这个mod_proxy错误时,这是因为Apache无法识别在unix套接字后面使用的代理模块 .

    假设你显然已经拥有: a2enmod proxy a2enmod proxy_http service apache2 restart

    位于 /etc/apache2/mods-available/proxy_http.load 的apache配置文件很可能为空

    将这些行添加到此文件:

    # Depends: proxy
    LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
    

    那么 service apache2 restart

相关问题