Skip to content

配置后重启nginx: nginx -s reload

nginx完整配置如下:

bash
[root@wiki ~]# cat /etc/nginx/conf.d/onedayxyy.cn.conf server{listen80;server_nameonedayxyy.cn;#配置https重定向return301https:}server{gzipon;gzip_typestext/plaintext/cssapplication/jsonapplication/javascripttext/xmlapplication/xmlapplication/xml+rsstext/javascript;listen443ssl;server_nameonedayxyy.cn;root/root/rsync/rsync-vitepress/dist;location/{indexindex.htmlindex.htm;try_files$uri $uri.html$uri/=404;# non existent pageserror_page404/404.html;# a folder without index.html raises 403 in this setuperror_page403/404.html;# adjust caching headers# files in the assets folder have hashes filenameslocation~*^/assets/{expires1y;add_headerCache-Control"public,immutable";}} location/images{alias/images;indexindex.html;valid_referersnoneblocked*.onedayxyy.cnonedayxyy.cn*.gitee.comgitee.com*.cnb.coolcnb.cool*.sleele.comlocalhost127.0.0.1;if($invalid_referer ) {# 如不满足,指定访问如下资源rewrite^/https:return403;}}location/error{autoindexon;# 启用目录索引alias/FdangDaoLianImages;indexindex.html;# 默认显示index.html文件,如果没有则列出目录内容} ssl_certificate/etc/letsencrypt/live/onedayxyy.cn/fullchain.pem;ssl_certificate_key/etc/letsencrypt/live/onedayxyy.cn/privkey.pem;ssl_session_timeout5m;ssl_protocolsTLSv1.1TLSv1.2TLSv1.3;ssl_ciphersEECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;ssl_prefer_server_cipherson;add_headerStrict-Transport-Security"max-age=31536000";access_log/var/log/nginx/onedayxyy.cn.https.log;}

(4)验证

访问自己域名:

https:

版权:此文章版权归 One 所有,如有转载,请注明出处!

链接:可点击右上角分享此页面复制文章链接

上次更新时间:

最近更新