Issue with Nginx serving Hugo static files with proper theme

77 views Asked by At

I’m facing an issue where the site loads fine with the hugo server command, but when served through Nginx with static files, the theme doesn’t load correctly.

nginx Configuration (Hugo Server)):

http {
    server {
        listen 80;
        server_name localhost;
    
        location / {
            proxy_pass http://localhost:1313; 
        }
    }
}

nginx Configuration (Static files):

http {
    server {
        listen 80;
        server_name localhost;
        root /Users/pramodchoudhari/personal_projects/my_blog/promode_me/public/;
        index index.html;
    }
}

Hugo Command for Public Directory Generation:

hugo --theme hugo-PaperMod

Hugo Server Command:

hugo server -D

This is how the site loads when i try to serve the static files using nginx enter image description here

This is the console log: enter image description here

I would appreciate any guidance or suggestions to resolve this issue. Thank you in advance for your help!

1

There are 1 answers

0
pramod On BEST ANSWER

Found the solution here: https://stackoverflow.com/a/11875443/6180721

include  /etc/nginx/mime.types;

This was missing in nginx.conf.