0

Hi I am running dotnet core on CentOS 7 with nginx reverse proxy. Following are my configurations.

   server {
        listen       443 ssl http2;
        listen       [::]:443 ssl http2;
        server_name  freebitcoins.zone www.freebitcoins.zone;
        root         /usr/share/nginx/html;

        ssl_certificate "/home/Ssl/freebitcoins.zone.crt";
        ssl_certificate_key "/home/Ssl/freebitcoins.zone.key";
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;


        location / {
        autoindex on;
        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 $http_host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location /websocket/ {

        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 $http_host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
server {
        listen 80;
        listen [::]:80;
        server_name freebitcoins.zone www.freebitcoins.zone;
        return 301 https://$server_name$request_uri;
}

The problem I am facing is , its not loading css or js files (all static). enter image description here

I do get the following errors in Asp.net Core Logging.

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.7387ms 404
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://freebitcoins.zone/web_assets/images/logo.png
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.3727ms 404
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://freebitcoins.zone/favicon.ico
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.5379ms 404

Please help me what I have done wrong or whats the issue. Its eating my head for 3 days now.

1
  • To make it even worse, sometimes it works sometimes it doesnt! Apr 9 '18 at 8:28
0

I figured it out. Anyone who is stuck here. The thing is simple.

dotnet /home/freeExWeb/freeExWeb.dll &

This will not load css or js files for some reason.

But if you run the dotnet process from its own directory. Woala!

cd /home/freeExWeb/
dotnet freeExWeb.dll &

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.