hugo发布到nginx流程

  • 所有文章页面顶部全部配置为draft: false
title: "新的文章"
date: 2021-12-17T15:06:23+08:00
draft: false # 这里
  • hugo打包成静态文件放在public目录下
hugo --baseUrl="/"
  • 将public目录下的文件全部上传到nginx配置的vhost路径下
  • 附nginx配置文件
server {
    listen       80;
    server_name  btiwork.com www.btiwork.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        #rewrite /ui/(.*)$ /$1 break;
        root   /opt/data/blogdata/public;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html/;
    }

}