常见问题

创建日期:2024-06-21
更新日期:2024-12-18

1、502 Bad Gateway问题。

现象:打开网页,报502 Bad Gateway错误。查看配置文件logs/error.log,发现SSL_do_handshake() failed (SSL: error:1408F10B:SSL routines:ssl3_get_record:wrong version number) while SSL handshaking to upstream。

解决方法:在location配置里增加proxy_ssl_session_reuse off;即可。

参考文档:https://blog.csdn.net/qq_15378385/article/details/92804061

2、504 Gateway Time-out问题。

现象:请求超过一分钟后,报504 Gateway Time-out错误。

解决方法:在nginx/conf/nginx.conf配置里,增加以下配置即可。

server {
    listen *:8080;
    server_name 127.0.0.1;

    location / {
        root   html;
        index  index.html index.htm;
    }
  
    location ^~ /api/ {
        proxy_pass http://127.0.0.1:8009/;
        proxy_read_timeout 3600s;
    }
}

3、nginx代理的页面无法访问。错误日志:2024/01/15 11:24:17 [emerg] 20084#1656: *5262928 malloc(10485760) failed (8: Not enough storage is available to process this command) while waiting for request, client: 218.17.81.154, server: 0.0.0.0:8006

由于系统内存不足导致的, 执行nginx -s reload是无法解决的,需要在任务管理器结束所有nginx进程,重启nginx。

4、nginx: [error] OpenEvent("Global\ngx_reload_6240") failed (2: The system cannot find the file specified)。

nginx没启动就执行 nginx -s reload 。先启动nginx,再执行 nginx -s reload 。

5、启动nginx报错:nginx: [emerg] bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)。

端口被占用了,更换端口即可。