Welcome! Log In Create A New Profile

Advanced

Nginx 502 Bad Gateway , dotnet Core 7

Posted by tonysar 
Nginx 502 Bad Gateway , dotnet Core 7
November 28, 2023 08:56PM
Hello everyone.
Using Ubuntu 23 VPS, Dotnet Core 7, NopCommerce 4.60.5
As per documents ,I have installed Nopcommerce on ubuntu , using Nginx as Reverse Proxy. Front and Backend functions, however, when I restart nopcommerce , I get 502 Bad Gateway error .
I have service script added to systemd and this starts the dotnet core after 10 seconds.
Error logged in Nginx error.log , Connection refused to upstream.
I have almost gone through entire Net regarding this issue and have tried every thing that posted as suggestions. nothing so far fixed this issue.

here is nginx configuration in sites-available folder.

server {

# include snippets/snakeoil.conf;

root /var/www/solution/html;

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

server_name MYDOMAIN.ca www.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;


root /var/www/solution/html;
proxy_pass http://localhost:5000;
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/MYDOMAIN.ca/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/MYDOMAIN.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 have local system as well that been experimenting on nginx with all solution that i can find . nothing worked. is been 4 straight days. 11 hours . no more hair ..
i would greatly appreciate if anyone can help me figure this out , as i have been told this is issue with reverse proxy , but yet After 4 days, i believe is a App problem .
Thanks.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 154
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready