使用 Nginx 作为反向代理并开启缓存提高网站性能

使用 Nginx 作为反向代理并开启缓存提高网站性能
# 设置代理缓存路径位置,最大大小为1g
proxy_cache_path  /etc/blog_cache  levels=1:2 keys_zone=blogcache:100m inactive=24h max_size=1g;

server {
	listen 443
	server_name blog.monogogo.cn;

	location / {
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto https;
		proxy_pass http://127.0.0.1:2368;

		# 删除对匿名访问者无效的cookies并阻止缓存
		proxy_ignore_headers Set-Cookie Cache-Control;
		proxy_hide_header Set-Cookie;
		# 为缓存状态添加标头(未命中或命中
		add_header X-Cache-Status $upstream_cache_status;

		proxy_cache blogcache;
		# 默认 TTL: 1 天
		proxy_cache_valid 1d;
		# 缓存 404 页 1小时
		proxy_cache_valid 404 1h;
		# 在刷新来自服务器的内容时使用GET请求
		proxy_cache_revalidate on;
		proxy_buffering on;
		#允许启动后台子请求以更新过期的缓存项
		# 不缓存错误
		proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
	}

	# 不缓存页面
	location ^~ /ghost/ {
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto https;
		proxy_pass http://127.0.0.1:2368;
	}

}

Read more

Flutter入门指南

Flutter入门指南

Flutter 是一个由 Google 开发的开源移动应用开发框架。它允许开发者使用一套代码同时构建 iOS 和 Android 应用,并且提供了丰富的 UI 组件和高效的开发工具,使得开发者能够快速构建出高性能的跨平台应用。 一、Flutter 的实现原理 Flutter 的核心在于其自带的高性能渲染引擎 Skia。不同于其他框架依赖于原生的 UI 组件,Flutter 直接通过 Skia 渲染引擎将所有组件绘制到屏幕上。这种方式保证了跨平台应用在 iOS 和 Android 上的表现完全一致。 1.1 结构概览 Flutter 的架构分为三层: 1. Framework(框架层): 这部分主要由 Dart 编写,提供了 Flutter 的各种 UI 组件(Widget)、手势检测、渲染层以及动画等。

By Lewis
Certbot Let's Encrypt 证书自动续期

Certbot Let's Encrypt 证书自动续期

安装 Certbot yum install epel-release -y yum install certbot -y certbot certonly //生成证书 certbot renew //续期 certbot certificates //查看证书 域名验证插件 https://github.com/ywdblog/certbot-letencrypt-wildcardcertificates-alydns-au 下载 $ git clone https://github.com/ywdblog/certbot-letencrypt-wildcardcertificates-alydns-au $ cd certbot-letencrypt-wildcardcertificates-alydns-au $ chmod 0777 au.sh 配置 DNS API 密钥: 这个 API 密钥什么意思呢?由于需要通过 API 操作阿里云 DNS,

By Lewis