【问题标题】:Nginx-redis server setup 502 bad gateway errorNginx-redis 服务器设置 502 bad gateway 错误
【发布时间】:2014-06-28 01:05:37
【问题描述】:

在云虚拟机上
我用 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 bad gateway openresty/1.5.12.1

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

我在哪里犯错了?

【问题讨论】:

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

标签: nginx redis openresty


【解决方案1】:
  1. 确保您的 nginx 配置正确:nginx -p pwd/ -c my_nginx.conf -t
  2. 确保您的 redis 服务器正常工作:redis-cli -p 6379
  3. 检查error.log

我测试了你的 conf 并且它有效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-26
    • 2017-01-06
    • 2018-04-23
    • 2021-09-11
    • 2018-01-20
    • 2017-05-10
    • 2022-07-14
    相关资源
    最近更新 更多