0

I am using NopCommerce 4.60.5 , with Ubuntu 23 , Nginx as Reverse proxy to upstream .net app. Site is up and running with some minor issues that im working on. however, issue starts when I have restart nopCommerce from admin when some changes to the setting happens and i get 502 Bad Gateway error. nginx error log shows , connection refused to upstream server. I have local server and production server , both have same exact issue. is been 7 days that i have search and tried almost everything out there to see i can fix this but nothing has worked. here is my configuration ..

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 

} I would really appreciate if anyone can help me in fixing this issue that been having for past 7 days .

2
  • I am not familiar with this software but based on you configuration looks like should be a service running on the port 5000, is it the server service running? Could you try login into the server and run curl localhost:5000 if you dont get any response that mean the service that start the app on port 5000 is not running. Commented Nov 29, 2023 at 18:12
  • Hi. upstream server is running on port 5000. this is how Dotnet server works. site in general working fine , both front end and back end. is restarting nopcommerce cause the 502 error. normally there is 10 second wait before upstream server starts . i guess there must be someway configure nginx to wait 10 seconds before reconnecting to upstream server . Commented Nov 29, 2023 at 22:39

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.