Nginx 502 Bad Gateway

5 ヶ月 前
nopcommerce 4.60.5
ubuntu 23
Installation is successful on two different Linux ( dev , production) . the only problem, is that when in admin , clicking start application , I get 502 Bad gateway error.
for past 2 days, been searching all possible solution and trying them all with no avail.
Log file indicates connection refused to upstream server. so my assumption is that , when restarting nopcommerce , it will also start upstream server ?? however, service script(deamon) starts the upstream server after 10 second and i can enter to both front and back end .. since this is happening to both linux installation (different linux os ), i can only assume , either there is a Bug in nopcommerce or there is missing extension or configuration that I have not been able to find.
If anyone with knowledge of Linux / nginx / asp dot net configuration here can help figuring this one out. i will greatly appreciate it.
Thanks
5 ヶ月 前
I am still having this issue.
so in console , i ran following command
dotnet /var/www/nopcommerce/Nop.Web.dll   as suggested in asp.net documentation . and i got following result :

Unhandled exception. System.IO.DirectoryNotFoundException: /home/User_name/Themes/
   at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
   at Nop.Web.Framework.Infrastructure.Extensions.ApplicationBuilderExtensions.UseNopWebOptimizer(IApplicationBuilder application)
   at Nop.Web.Framework.Infrastructure.NopStaticFilesStartup.Configure(IApplicationBuilder application)
   at Nop.Core.Infrastructure.NopEngine.ConfigureRequestPipeline(IApplicationBuilder application)
   at Nop.Web.Framework.Infrastructure.Extensions.ApplicationBuilderExtensions.ConfigureRequestPipeline(IApplicationBuilder application)
   at Program.<Main>$(String[] args)
Aborted (core dumped)


Nop.Web.dll , seems to be looking at root folder of user that has installed nopcommerce , for Theme ??I found that in home folder fo user , nopcommerce also created App_Data , with json file , also Plugin folder with Uploaded subfolder that is empty .
any suggestion ?
Thanks
5 ヶ月 前
Digging some more on Microsoft DOTNET CORE. Setting up dotnet core on Linux with Nginx as reverse proxy . The default ASP.NET server , is Kestrel .. so i guess Nop.Web.dll is the webserver ??
in article for setting up dotnet core with linux shows that , when response made , Page header shows Server : Kestrel . when i examine header of my site , it shows Nginx as server .  after going through all i can find .. it has to be some issue with asp.net server ...hope someone can figure this out , as it started to drive me CRAZIER ..

using netstat .. i can see port 5000 assigned to localhost and listening and nginx is working correctly.
5 ヶ月 前
tonysar wrote:
... I ran following command
dotnet /var/www/nopcommerce/Nop.Web.dll   as suggested in asp.net documentation...

I don't see anything in the docs about running that.

Nginx proxies requests to the nopCommerce application.  The directions in the doc describe setting up a service to run nopCommerce.
5 ヶ月 前
thanks for reply.
be honest ,i m not sure what part of doc that was. i had to go through pages to try to fix this issue which as i have stated , effect two installation one on local and other on VPS hosting .. both exact same issue. so , i had to rule out hardware , as my host examined the server and found nothing wrong ..
5 ヶ月 前
See if anything in here helps (see Troubleshooting at the end)
https://www.pronopcommerce.com/running-nopcommerce-on-linux-vps-1
4 ヶ月 前
Can you share nginx configurations where you defined the upstream server, where you define the location and the proxy_pass value for the same?
4 ヶ月 前
Thank for reply. base on all the doc i found. deploying .NET app on linux has same configuration as nopc ..here is the content of my vhost

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 supplysolution.ca www.supplysolution.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 supplysolution.ca www.supplysolution.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.supplysolution.ca) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = supplysolution.ca) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
        listen 80;
        listen [::]:80;
        server_name supplysolution.ca www.supplysolution.ca;
    return 404; # managed by Certbot
}
4 ヶ月 前
Anyone actually runs Nopcommerce 4.60.5 on Linux without any issues .. ?
I reached the end of google search and found nothing that fix this .
so at this point i do believe issue is in the nopcom core .. hope a patch be released soon ..
Thanks.
4 ヶ月 前
Have you reviewed / tried this?