Hugo site CSS not loading after adding SSL certificate with Nginx

Viewed 617

https://www.greenhousemarketplace.com

After freshly installing certbot and forcing HTTPS redirect, my CSS and JS no longer loads, even though it is accessible via direct URL.

I'm not sure why, I've updated the links to the CSS and JS files, and set my config.toml to include the https prefix.

sites-enabled/ghm-landing-page

server {
        root /var/www/ghm-landing-page/public/;

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

        server_name greenhousemarketplace.com;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/greenhousemarketplace.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/greenhousemarketplace.com/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 = greenhousemarketplace.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80 default_server;
        listen [::]:80 default_server;

        server_name greenhousemarketplace.com;
    return 404; # managed by Certbot

config.toml

# Site settings
baseurl = "https://www.greenhousemarketplace.com/"
languageCode = "en-us"
title = "Greenhouse Marketplace"
theme = "hugo-highlights-theme"
1 Answers

The Javascript is not loading because you are loading mixed content. The script tags at the bottom of the page should use the https:// scheme.

The CSS is not loading because of a SSL_ERROR_BAD_CERT_DOMAIN error. You have the content loading on www., which is a domain not listed on your certificate. Using your cert issuer, be sure to add both the www. and non-www. domains of your domain.

Related