我正在尝试使用带有 apache 2.4.10 的 unix 套接字,但一直收到错误No protocol handler was valid for the URL /foo.
我已经mod_proxy_uwscgi
安装并启用。
我的虚拟主机如下所示:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName foo.example.com
<Location />
ProxyPass unix:/path/to/socket.sock|uwscgi://
</Location>
</VirtualHost>
输出apachectl -M
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
headers_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php5_module (shared)
proxy_module (shared)
proxy_ajp_module (shared)
proxy_fcgi_module (shared)
proxy_http_module (shared)
proxy_uwsgi_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)
我不知道我做错了什么。
答案1
你打错了。不是 uwscgi,而是 uwsgi。
来自UWSGI 文档:
从 Apache 2.4.9 开始,添加了对 Unix 套接字的支持。语法非常简单:
ProxyPass / unix:/var/lib/uwsgi/app1.sock|uwsgi://uwsgi-uds-app1/
ProxyPass / unix:/var/lib/uwsgi/app2.sock|uwsgi://uwsgi-uds-app2/
答案2
我认为您可能需要用以下行来代替您当前拥有的内容:ProxyPass uwscgi://path/to/socket.sock
除此之外,unix/uwscgi 路径以 URI 形式提供,其格式应为 PROTOCOL://PATH。如果 PATH 是规范路径,则可以使用例如 unix:///dev/null。