5

nginx 根据国家IP代理不同服务。index.html 不缓存

 2 years ago
source link: https://yazhen.me/_posts/2021/nginx-cache/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

注意需要有个country-code文件。

德语,日语,英语 版本

  1. 用分支来管理三个网站
  2. 用端口来分开运行
  3. 部署测试环境一套
  4. 利用nginx map 配置
map $geoip_country_code $upstream {
	LR		web_lr;
	US		web_us;
	RU		web_russia;
	default		$subnet;
}

index.html

index.html 不需要缓存,静态资源需要缓存。目前使用的方案

location ~* \.(jpg|png|css|js|font|eot|ttf|woff|woff2)$ {
   root /usr/local/erp/online-booking/;
}

location / {
    add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
    root /usr/local/erp/online-booking;
    index index.html;
    try_files $uri $uri/ /index.html;
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK