Nginx fails to load CSS in Asp.net Core on Raspberry Pi

First and foremost, thank you for taking the time to read my post. Secondly, I apologize for any language errors in advance.

I am currently attempting to run an Asp.net core application on a Raspberry Pi, but I am encountering difficulties with nginx proxying.

Essentially, I have been following these tutorials to set up my workspace and deploy my project to arm architecture. The only variance is that instead of a basic Hello World application, I have created an MVC application:

The issue arises when I launch the application. By default, it operates on port 5000, but upon nginx proxying to port 80, it fails to load the css.min, javascript files, and the Home directory as seen in the image below:

Refer to the nginx configuration provided below:

server {
   listen 80 default_server;
          listen [::]:80 default_server;

          root /www/mywebsite;

          index index.html index.htm index.nginx-debian.html;

          server_name _;


            location / {
            proxy_pass http://127.0.0.1:5000;
            proxy_set_header Connection "";
            proxy_http_version 1.1;
            proxy_set_header    Host $host;
            proxy_set_header    X-Real-IP   $remote_addr;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;

             try_files $uri $uri/ =404;
            }}

Answer №1

Based on my observation, I recommend omitting the try_files directive from the configuration:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name _;

    root /www/mywebsite;
    index index.html index.htm index.nginx-debian.html;

    location / {
        proxy_pass http://127.0.0.1:5000;
        proxy_set_header Connection "";
        proxy_http_version 1.1;
        proxy_set_header    Host $host;
        proxy_set_header    X-Real-IP   $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
    }}
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to turn off Bootstrap links hover background color?

I recently added a Bootstrap menu to my website that I'm currently working on. I am curious about how to disable the hover background color for Bootstrap links. Here's the situation: Below is an example of the menu I implemented: Currently, whe ...

Developing clickable hyperlinks within a jQuery Datatable

I am currently in the process of transitioning from an asp.net GridView Control to a jQuery DataTable with Ajax. On my project's home page, I have a visually appealing image grid that is justified. Each image in this grid acts as a link, redirecting u ...

Glimpse triggering 500 error when loading images and CSS files

While setting up Glimpse on a .NET 4.6 project, I encountered an issue when installing the Asp.Net package from NuGet. All CSS and images started throwing a 500 error. To troubleshoot, I installed packages one by one until the error occurred with the speci ...

Lagging loading times on my ASP.NET MVC 4 website

Recently, I have been noticing a frustratingly slow response from certain pages on my website. Typically, my pages load in just 1 second, but every now and then, they can take up to 10 seconds or even longer. Below is a screenshot of the MiniProfiler outp ...

Is it possible to utilize the MicrosoftMvcValidation.js functions in ASP.NET MVC to enforce a required field for an <input type="file"> element?

In my form, I have a file upload button along with other entry fields and a submit button. My goal is to only enable the submit button if a file has been selected. While I could achieve this using JQuery, I am considering leveraging the MicrosoftMvcValid ...

What is the best way to use CSS to center two blocks with space in between them?

My goal is to achieve a specific design: I want two text blocks with some space in between them aligned around the midline of the page (refer to the image). I have experimented with the float property, as well as used margin and padding to create the gap ...

Link inserted in between spaces

Working with Eloqua. Any ideas on what might be causing a space to appear in a link? The space doesn't show up during testing, only in the live version. Here is the code snippet: <p style="line-height:18px;"> <font face="calibri, Arial, H ...

Tips for aligning an element vertically when it has a float using CSS or JavaScript

I am struggling with centering the image within the article list loop I created. The code snippet looks like this: <article class="article <?php if($i%2==0) { echo 'even'; } else { echo 'odd'; } ?>"> <section class ...

Creating a Cancel Button in JSP/HTML/JS/CSS Form: A Step-by-Step Guide

It is necessary to incorporate the functionality of "save" and "cancel" in the JSP code for this particular form. By selecting "save", the data entered into the form will be submitted to its intended destination. Alternatively, choosing "cancel" will dismi ...

Internal link formatting using CSS styling

I have a question about formatting links with fonts and colors to make them clickable. I managed to achieve the desired font and color styles using a specific code snippet, but struggled to make the link clickable: <table border="0" cellpadding="1" cel ...

Modify the CSS of one div when hovering over a separate div

I've been working on a simple JavaScript drop-down menu, and it's been functioning correctly except for one issue. When I move the mouse out of the div that shows the drop-down menu, it loses its background color. I want the link to remain active ...

Styling a playbook using CSS Grid management techniques

Exciting to create a playbook layout style, here's how it goes: Name: Text starting here - unique style #1 text that moves to a new line with a different look - unique style #2 more text continuing on another new line ...

What causes the occurrence of 00:00:00 at the end of the date in the datatable in asp.net?

Hey, I have a question regarding a stored procedure I am executing from the function below. For some reason, every date I retrieve from the database has the time appended to the end like this - 19:12:2012 00:00:00. Even though both the column in the databa ...

The mouse pointer adjusts according to the event

I am working on an ajax request and I have implemented a feature where the cursor changes appearance. document.body.style.cursor = "wait"; This immediately shows the cursor as a spinning circle when the request starts. At the end of the request, I ch ...

What is the best way to send a populated custom class from JavaScript to a .NET MVC app using AJAX?

I am working with a .NET class in C# called BusinessModel: public class BusinessModel { public string BlobName { get; set; } public string NewName { get; set; } } In my MVC Ajax Controller, I have an action called DoBusiness: [HttpPost] public A ...

Tips for beginning the process of creating a website's user interface

After initially developing my system without any styling, including bootstrap and CSS, I now find myself needing to add them. While I have reviewed the concepts on W3Schools and have a basic understanding, I am struggling with the sequence of implementat ...

The links located beneath the iframe/span element are unclickable

My latest creation is a static advert ticker positioned at the bottom of the window. It's contained within an <iframe> for easy placement on other websites. I added a <span> around the <iframe> to keep it fixed at the bottom of the s ...

Invoking a URL asynchronously on a website

Unique Font License Dilemma Recently, I came across a unique situation with a font license that required me to query a counter on the font provider's domain every time the typeface was displayed. However, the recommended method of using import in the ...

Align the text to the left on the same line as the content

I'm trying to align text and an image on the same line, but there's some empty space at the top of the text. Is there a way to align them? <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" rel="styl ...

JavaScript code often contains dates that are formatted in various ways

I need to perform validation in JavaScript by comparing DATES and TIME. I need to have the date in dd/MM/yyyy format, but I am unsure of the format it is currently taking. After debugging the JavaScript code, I discovered the format. The screenshot below ...