Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Nginx添加SSL证书后未加载Hugo站点CSS_Go_Ssl_Nginx_Hugo_Certbot - Fatal编程技术网

使用Nginx添加SSL证书后未加载Hugo站点CSS

使用Nginx添加SSL证书后未加载Hugo站点CSS,go,ssl,nginx,hugo,certbot,Go,Ssl,Nginx,Hugo,Certbot,在新安装certbot并强制HTTPS重定向后,我的CSS和JS不再加载,即使可以通过直接URL访问 我不知道为什么,我已经更新了CSS和JS文件的链接,并将config.toml设置为包含https前缀 站点启用/ghm登录页 server { root /var/www/ghm-landing-page/public/; index index.html index.htm index.nginx-debian.html; server_n

在新安装certbot并强制HTTPS重定向后,我的CSS和JS不再加载,即使可以通过直接URL访问

我不知道为什么,我已经更新了CSS和JS文件的链接,并将config.toml设置为包含https前缀

站点启用/ghm登录页

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"

Javascript没有加载,因为您正在加载混合内容页面底部的脚本标记应使用https://scheme。


由于出现
SSL\u错误\u坏证书\u域
错误,CSS未加载。您在
www.
上加载了内容,该域未列在您的证书上使用您的证书颁发者,确保同时添加您域的www.域和非www.域。

这很有效。我编辑了我的config.toml以排除www子域。谢谢从www子域进行限制是一种不好的做法,还是我也应该为此生成一个证书?@JoeHoward您应该同时生成这两个证书。一些用户可能有键入www的习惯,一些浏览器(尤其是Firefox)在发现域名拼写错误时会自动添加www。