Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nginx redis服务器设置502网关错误_Nginx_Redis_Openresty - Fatal编程技术网

Nginx redis服务器设置502网关错误

Nginx redis服务器设置502网关错误,nginx,redis,openresty,Nginx,Redis,Openresty,云上虚拟机 我使用redis和openresty设置了这个nginx.conf文件 my_nginx.conf- worker_processes 1; error_log logs/error.log; events{ worker_connections 1024; } http { server { listen 8080; location / { redis2_query set hello world; redis2_que

云上虚拟机
我使用redis和openresty设置了这个nginx.conf文件

my_nginx.conf-

worker_processes 1;
error_log logs/error.log;
events{
    worker_connections 1024;
}
http {
 server {
     listen 8080; 
     location / {
       redis2_query set hello world;
       redis2_query get hello;
       redis2_pass 127.0.0.1:6379;
     }
  }
}
我运行这个conf作为

$nginx -p pwd/ -c my_nginx.conf
现在,当我在本地浏览器中访问这个虚拟机的ip地址时,我发现了一个错误

502坏网关
openresty/1.5.12.1

http://xxx.xxx.xxx.xxx:8080/

我哪里出错了

  • 确保您的nginx配置正确:
    nginx-ppwd/-cmy\u nginx.conf-t
  • 确保您的redis服务器正在工作:
    redis cli-p 6379
  • 检查
    error.log

  • 我测试了您的conf,它正常工作。

    这个问题似乎属于Stack Exchange网络中的另一个站点,因为它与编程无关。也许是。