Forum Discussion

tonysar's avatar
tonysar
Copper Contributor
Nov 26, 2023

502 Bad Gateway Linux Nginx dotnet Core

Hello. 

As the title shows, I don't have much experience with Windows ...Last time I used Window , was DOS.

However,  project I am working on , is running NopCommerce ( dotnet ) on Linux ubuntu , using Nginx and Mysql . 

I have followed the tutorial , installed dotnet core 7 and created Service ( daemon ) and installed nopcommerce. everything work fine except one issue. at times , from nopcommerce admin, I have to restart application , when i do , i get 502 Bad Gateway error . system restarts after 10 seconds as per daemon configuration . for past 3 days , I been looking at everything i could find to solve this issue. 

I used following command as per microsoft documentation .. 

 

dotnet /var/www/nopcommerce/Nop.Web.dll 

I got the 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)

 

as you can see in this error .. path to Themes directory is not correct. it should be path to /var/www/nopcommerce /... 

I am not exactly sure what else I could do .. so hoping someone with some experience can guide me to the solution . 

Thanks. 

1 Reply

  • tonysar's avatar
    tonysar
    Copper Contributor
    Forgot to mention ..
    Nginx log shows : Connection refused to upstream server .. this i believe is dotnet server
    Thanks

Resources