Openresty 错误:[emerg] 14574#0: unknown directive "redis2_query",
Openresty 错误:[emerg] 14574#0: unknown directive "redis2_query",
该问题源头:在 Openresty 中使用 HttpRedis2Module,示例如下:
location /http2redisget {
set $key hello;
redis2_query get $key;
redis2_pass 127.0.0.1:6379;
}
重启 nginx
./sbin/nginx -s reload
请求 / http2redisget 时出现如下错误在日志中:
2019/03/28 16:42:01 [emerg] 14574#0: unknown directive "redis2_query" in /usr/local/openresty/nginx/conf/nginx.conf:213
一、确保 Openresty、Redis 的版本兼容
https://github.com/openresty/redis2-nginx-module#Compatibility
在合适版本内,HttpRedis2Module 在 Openresty 中是默认开启的。
二、确保 ./configure 编译 Openresty 时没有增加
--without-http_redis2_module
三、Nginx 重启的问题,尝试
./sbin/nginx -s stop
./sbin/nginx
本人出现的这个问题就是通过 stop 然后 重新启动 nginx 解决的,reload Nginx 有时候并没有把新的配置项加载进来。
评论暂时关闭