### You should look at the following URL's in order to grasp a solid understanding# of Nginx configuration files in order to fully unleash the power of Nginx.# https://www.nginx.com/resources/wiki/start/# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/# https://wiki.debian.org/Nginx/DirectoryStructure## In most cases, administrators will remove this file from sites-enabled/ and# leave it as reference inside of sites-available where it will continue to be# updated by the nginx packaging team.## This file will automatically load configuration files provided by other# applications, such as Drupal or Wordpress. These applications will be made# available underneath a path with that package name, such as /drupal8.## Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.### Default server configuration##server { listen 80;#listen [::]:80 default_server;# SSL configuration## listen 443 ssl default_server;# listen [::]:443 ssl default_server;## Note: You should disable gzip for SSL traffic.# See: https://bugs.debian.org/773332## Read up on ssl_ciphers to ensure a secure configuration.# See: https://bugs.debian.org/765782## Self signed certs generated by the ssl-cert package# Don't use them in a production server!## include snippets/snakeoil.conf; root /home/wcq/my_blog/public\\;#root /home/wcq/tmp/public\\;# Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; server_name skfwe.cn;#rewrite ^(.*)$ https://$host$1 permanent;# location / {# # First attempt to serve request as file, then# # as directory, then fall back to displaying a 404.# try_files $uri $uri/ =404;# }return301 https://$host$request_uri;}server {#监听443端口 listen 443 default;#你的域名 server_name skfwe.cn; ssl on;#ssl证书的pem文件路径 ssl_certificate /home/wcq/skfwe.cn_nginx/skfwe.cn_bundle.crt;#ssl证书的key文件路径 ssl_certificate_key /home/wcq/skfwe.cn_nginx/skfwe.cn.key; ssl_session_timeout 5m;#请按照以下协议配置 ssl_protocols TLSv1.2 TLSv1.3;#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; location / { root /home/wcq/my_blog/public\\;#root /home/wcq/tmp/public\\;# Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html;}}# Virtual Host configuration for example.com## You can move that to a different file under sites-available/ and symlink that# to sites-enabled/ to enable it.##server {# listen 80;# listen [::]:80;## server_name example.com;## root /var/www/example.com;# index index.html;## location / {# try_files $uri $uri/ =404;# }#}
测试配置文件正确性
1
2
3
4
wcq@VM-20-14-ubuntu:/etc/nginx# sudo nginx -t
nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/my_blog.conf:67
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
baseURL="http://www.skfwe.cn"# ubuntu# baseURL = "http://localhost:1313" # debug# baseURL = "https://skfwe.gitee.io/skfwe.io" # gitee pages 上传上去后还要进到服务->Pages 里面点击更新重新布置才可生效languageCode="zh-cn"defaultContentLanguage="zh-cn"# en / zh-cn / ... (This field determines which i18n file to use)title="与其感慨路难行,不如马上出发"preserveTaxonomyNames=trueenableRobotsTXT=trueenableEmoji=truetheme="even"enableGitInfo=false# use git commit log to generate lastmod record # 可根据 Git 中的提交生成最近更新记录。# Syntax highlighting by Chroma. NOTE: Don't enable `highlightInClient` and `chroma` at the same time!pygmentsOptions="linenos=table"pygmentsCodefences=truepygmentsUseClasses=truepygmentsCodefencesGuessSyntax=truehasCJKLanguage=true# has chinese/japanese/korean ? # 自动检测是否包含 中文\日文\韩文paginate=5# 首页每页显示的文章数disqusShortname=""# disqus_shortnamegoogleAnalytics=""# UA-XXXXXXXX-Xcopyright=""# default: author.name ↓ # 默认为下面配置的author.name ↓[author]# essential # 必需name="wcq"[sitemap]# essential # 必需changefreq="weekly"priority=0.5filename="sitemap.xml"[[menu.main]]# config your menu # 配置目录name="Home"weight=10identifier="home"url="/"[[menu.main]]name="Archives"weight=20identifier="archives"url="/post/"[[menu.main]]name="Tags"weight=30identifier="tags"url="/tags/"[[menu.main]]name="Categories"weight=40identifier="categories"url="/categories/"[params]version="4.x"# Used to give a friendly message when you have an incompatible updatedebug=false# If true, load `eruda.min.js`. See https://github.com/liriliri/erudasince="2022"# Site creation time # 站点建立时间# use public git repo url to link lastmod git commit, enableGitInfo should be true.# 指定 git 仓库地址,可以生成指向最近更新的 git commit 的链接,需要将 enableGitInfo 设置成 true.gitRepo=""# site info (optional) # 站点信息(可选,不需要的可以直接注释掉)logoTitle="Nothing To Say"# default: the title value # 默认值: 上面设置的title值keywords=["Hugo","theme","even"]description="Hugo theme even example site."# paginate of archives, tags and categories # 归档、标签、分类每页显示的文章数目,建议修改为一个较大的值archivePaginate=15# show 'xx Posts In Total' in archive page ? # 是否在归档页显示文章的总数showArchiveCount=true# The date format to use; for a list of valid formats, see https://gohugo.io/functions/format/dateFormatToUse="2006-01-02"# show word count and read time ? # 是否显示字数统计与阅读时间moreMeta=true# Syntax highlighting by highlight.jshighlightInClient=false# 一些全局开关,你也可以在每一篇内容的 front matter 中针对单篇内容关闭或开启某些功能,在 archetypes/default.md 查看更多信息。# Some global options, you can also close or open something in front matter for a single post, see more information from `archetypes/default.md`.toc=true# 是否开启目录autoCollapseToc=false# Auto expand and collapse toc # 目录自动展开/折叠fancybox=true# see https://github.com/fancyapps/fancybox # 是否启用fancybox(图片可点击)# mathjaxmathjax=false# see https://www.mathjax.org/ # 是否使用mathjax(数学公式)mathjaxEnableSingleDollar=false# 是否使用 $...$ 即可進行inline latex渲染mathjaxEnableAutoNumber=false# 是否使用公式自动编号mathjaxUseLocalFiles=false# You should install mathjax in `your-site/static/lib/mathjax`postMetaInFooter=true# contain author, lastMod, markdown link, license # 包含作者,上次修改时间,markdown链接,许可信息linkToMarkDown=false# Only effective when hugo will output .md files. # 链接到markdown原始文件(仅当允许hugo生成markdown文件时有效)contentCopyright=''# e.g. '<a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">CC BY-NC-ND 4.0</a>'changyanAppid=""# Changyan app id # 畅言changyanAppkey=""# Changyan app keylivereUID=""# LiveRe UID # 来必力baiduPush=false# baidu push # 百度baiduAnalytics=""# Baidu AnalyticsbaiduVerification=""# Baidu VerificationgoogleVerification=""# Google Verification # 谷歌# Link custom CSS and JS assets# (relative to /static/css and /static/js respectively)customCSS=[]customJS=[]uglyURLs=false# please keep same with uglyurls setting# Show language selector for multilingual site.showLanguageSelector=false[params.publicCDN]# load these files from public cdn # 启用公共CDN,需自行定义enable=truejquery='<script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>'slideout='<script src="https://cdn.jsdelivr.net/npm/slideout@1.0.1/dist/slideout.min.js" integrity="sha256-t+zJ/g8/KXIJMjSVQdnibt4dlaDxc9zXr/9oNPeWqdg=" crossorigin="anonymous"></script>'fancyboxJS='<script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.1.20/dist/jquery.fancybox.min.js" integrity="sha256-XVLffZaxoWfGUEbdzuLi7pwaUJv1cecsQJQqGLe7axY=" crossorigin="anonymous"></script>'fancyboxCSS='<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.1.20/dist/jquery.fancybox.min.css" integrity="sha256-7TyXnr2YU040zfSP+rEcz29ggW4j56/ujTPwjMzyqFY=" crossorigin="anonymous">'timeagoJS='<script src="https://cdn.jsdelivr.net/npm/timeago.js@3.0.2/dist/timeago.min.js" integrity="sha256-jwCP0NAdCBloaIWTWHmW4i3snUNMHUNO+jr9rYd2iOI=" crossorigin="anonymous"></script>'timeagoLocalesJS='<script src="https://cdn.jsdelivr.net/npm/timeago.js@3.0.2/dist/timeago.locales.min.js" integrity="sha256-ZwofwC1Lf/faQCzN7nZtfijVV6hSwxjQMwXL4gn9qU8=" crossorigin="anonymous"></script>'flowchartDiagramsJS='<script src="https://cdn.jsdelivr.net/npm/raphael@2.2.7/raphael.min.js" integrity="sha256-67By+NpOtm9ka1R6xpUefeGOY8kWWHHRAKlvaTJ7ONI=" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/flowchart.js@1.8.0/release/flowchart.min.js" integrity="sha256-zNGWjubXoY6rb5MnmpBNefO0RgoVYfle9p0tvOQM+6k=" crossorigin="anonymous"></script>'sequenceDiagramsCSS='<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/bramp/js-sequence-diagrams@2.0.1/dist/sequence-diagram-min.css" integrity="sha384-6QbLKJMz5dS3adWSeINZe74uSydBGFbnzaAYmp+tKyq60S7H2p6V7g1TysM5lAaF" crossorigin="anonymous">'sequenceDiagramsJS='<script src="https://cdn.jsdelivr.net/npm/webfontloader@1.6.28/webfontloader.js" integrity="sha256-4O4pS1SH31ZqrSO2A/2QJTVjTPqVe+jnYgOWUVr7EEc=" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/snapsvg@0.5.1/dist/snap.svg-min.js" integrity="sha256-oI+elz+sIm+jpn8F/qEspKoKveTc5uKeFHNNVexe6d8=" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/underscore@1.8.3/underscore-min.js" integrity="sha256-obZACiHd7gkOk9iIL/pimWMTJ4W/pBsKu+oZnSeBIek=" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/gh/bramp/js-sequence-diagrams@2.0.1/dist/sequence-diagram-min.js" integrity="sha384-8748Vn52gHJYJI0XEuPB2QlPVNUkJlJn9tHqKec6J3q2r9l8fvRxrgn/E5ZHV0sP" crossorigin="anonymous"></script>'# Display a message at the beginning of an article to warn the readers that it's content may be outdated.# 在文章开头显示提示信息,提醒读者文章内容可能过时。[params.outdatedInfoWarning]enable=falsehint=30# Display hint if the last modified time is more than these days ago. # 如果文章最后更新于这天数之前,显示提醒warn=180# Display warning if the last modified time is more than these days ago. # 如果文章最后更新于这天数之前,显示警告[params.gitment]# Gitment is a comment system based on GitHub issues. see https://github.com/imsun/gitmentowner=""# Your GitHub IDrepo=""# The repo to store commentsclientId=""# Your client IDclientSecret=""# Your client secret[params.utterances]# https://utteranc.es/owner="wcq062821"# Your GitHub IDrepo="blog_data"# The repo to store comments[params.gitalk]# Gitalk is a comment system based on GitHub issues. see https://github.com/gitalk/gitalkowner=""# Your GitHub IDrepo=""# The repo to store commentsclientId=""# Your client IDclientSecret=""# Your client secret# Valine.# You can get your appid and appkey from https://leancloud.cn# more info please open https://valine.js.org[params.valine]enable=falseappId='你的appId'appKey='你的appKey'notify=false# mail notifier , https://github.com/xCss/Valine/wikiverify=false# Verification codeavatar='mm'placeholder='说点什么吧...'visitor=false[params.flowchartDiagrams]# see https://blog.olowolo.com/example-site/post/js-flowchart-diagrams/enable=falseoptions=""[params.sequenceDiagrams]# see https://blog.olowolo.com/example-site/post/js-sequence-diagrams/enable=falseoptions=""# default: "{theme: 'simple'}"[params.busuanzi]# count web traffic by busuanzi # 是否使用不蒜子统计站点访问量enable=falsesiteUV=truesitePV=truepagePV=true[params.reward]# 文章打赏enable=truewechat="/ox-hugo/wechat.png"alipay="/ox-hugo/alipay.png"# 支付宝二维码[params.social]# 社交链接a-email="mailto:your@email.com"g-github="https://github.com/wcq062821"# See https://gohugo.io/about/hugo-and-gdpr/[privacy][privacy.googleAnalytics]anonymizeIP=true# 12.214.31.144 -> 12.214.31.0[privacy.youtube]privacyEnhanced=true# see https://gohugo.io/getting-started/configuration-markup[markup][markup.tableOfContents]startLevel=1[markup.goldmark.renderer]unsafe=true# 将下面这段配置取消注释可以使 hugo 生成 .md 文件# Uncomment these options to make hugo output .md files.#[mediaTypes]# [mediaTypes."text/plain"]# suffixes = ["md"]##[outputFormats.MarkDown]# mediaType = "text/plain"# isPlainText = true# isHTML = false##[outputs]# home = ["HTML", "RSS"]# page = ["HTML", "MarkDown"]# section = ["HTML", "RSS"]# taxonomy = ["HTML", "RSS"]# taxonomyTerm = ["HTML"]