Apache mod_proxy_uwsgi 和 unix 域套接字

标签 apache config uwsgi unix-socket

我有一个为 unix 域套接字运行的 uwsgi 服务器

[uwsgi]
...
socket = /var/run/someuwsgi.sock
socket = localhost:9987
...

mod_proxy_uwsgi 已安装

在 apache 配置中有这样一行: ProxyPass/一些 uwsgi://localhost:9987

它正在工作。

问题:通过 unix 域套接字的 apache 配置行应该是什么 /var/run/someuwsgi.sock ? 我试过了

ProxyPass /some uwsgi:///var/run/someuwsgi.sock

得到了

Bad Request
Your browser sent a request that this server could not understand.

也尝试过

ProxyPass /some uwsgi://unix:///var/run/someuwsgi.sock

得到了

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /some/.

Reason: DNS lookup failure for: unix:

谢谢!

最佳答案

Starting from Apache 2.4.7 ,添加了对 Unix 套接字的支持。语法非常简单:

ProxyPass / unix:/tmp/uwsgi.sock|uwsgi://

关于Apache mod_proxy_uwsgi 和 unix 域套接字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21019717/

相关文章:

virtualenv - uWSGI + virtualenv 'No module named site'

php - 检查最后修改的目录

apache - 无法通过 PHP 连接到 Postgres,但可以从不同机器上的命令行和 PgAdmin 连接

vue.js - 将 "proposal-object-rest-spread"插件添加到 babel.config.js 以修复 Microsoft Edge 错误 SCRIPT1028

Solr 配置中的 Solr 突出显示

nginx - 设置环境变量 - nginx + uWSGI

apache - 重定向和查询字符串的问题

php - mod_rewrite 最佳实践

angularjs - 检测到损坏的拦截器 - angular-loading-bar

django - uwsgi导入错误: No module named os