我正在使用 NopCommerce 4.60.5 和 Ubuntu 23,Nginx 作为上游 .net 应用程序的反向代理。网站已启动并运行,但存在一些小问题,我正在努力解决。但是,当我从管理员重新启动 nopCommerce 时,问题开始出现,当设置发生某些更改时,我收到 502 Bad Gateway 错误。nginx 错误日志显示,拒绝连接上游服务器。我有本地服务器和生产服务器,两者都有完全相同的问题。已经 7 天了,我搜索并尝试了几乎所有方法来解决此问题,但没有任何效果。这是我的配置..
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; # 由 Certbot 管理 ssl_certificate_key /etc/letsencrypt/live/supplysolution.ca/privkey.pem; # 由 Certbot 管理 include /etc/letsencrypt/options-ssl-nginx.conf; # 由 Certbot 管理 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # 由 Certbot 管理
} 服务器 { 如果 ($host =www.MYDOMAIN.ca){return 301 https://$host$request_uri; } # 由 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
} 如果有人能帮助我解决过去 7 天一直存在的这个问题,我将不胜感激。