You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

NopCommerce 4.60.5 重启后 Nginx 返回 502 Bad Gateway 问题求助

NopCommerce 4.60.5 重启后 Nginx 返回 502 Bad Gateway 问题求助

各位大佬好,我现在被一个问题折腾整整7天了,网上能搜到的办法几乎都试了一遍,还是没解决,实在没办法来求助了!

我的环境是:NopCommerce 4.60.5 + Ubuntu 23 + Nginx反向代理.NET后端应用。网站平时正常运行,只有一些小问题在慢慢调试,但每次在后台修改设置后重启NopCommerce时,就会立刻出现502 Bad Gateway错误,查看Nginx的错误日志,显示的是“connection refused to upstream server”。更头疼的是,本地测试服务器和生产服务器环境完全一致,都出现了这个问题。

下面是我的Nginx配置文件内容:

server {
    # include snippets/snakeoil.conf;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name www.MYDOMAIN.ca MYDOMAIN.ca;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        #try_files $uri $uri/ =404;

        proxy_pass         http://localhost:5000;
        add_header 'Content-Security-Policy' 'upgrade-insecure-requests';

        proxy_http_version    1.1;
        proxy_set_header      Upgrade $http_upgrade;
        proxy_set_header      Connection keep-alive;
        proxy_set_header      Host $host;
        #proxy_set_header      X-Real-IP $remote_addr;
        proxy_cache_bypass    $http_upgrade;
        #proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
        #proxy_set_header      X-Forwarded-Proto $scheme;
        #proxy_set_header      X-Frame-Options SAMEORIGIN;
        #proxy_set_header      X-Forwarded-Host $host;
        #proxy_read_timeout    900;
    }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    server_name MYDOMAIN.ca www.MYDOMAIN.ca;
    ssl_certificate /etc/letsencrypt/live/supplysolution.ca/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/supplysolution.ca/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = www.MYDOMAIN.ca) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    if ($host = MYDOMAIN.ca) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;
    server_name MYDOMAIN.ca www.MYDOMAIN.ca;
    return 404; # managed by Certbot
}

真心希望各位能帮我找出问题所在,解决这个困扰我一周的麻烦!

备注:内容来源于stack exchange,提问作者tonysar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 07:39:39