Logo Ricky
  • Home
  • About
  • More
    Skills Experiences Education Projects
  • Posts
  • Notes
  • Activities
  • Running
  • English
    English Chinese
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • Tags
  • AI
  • Ansible
  • APP
  • BASH
  • Browser
  • Byte
  • Chart
  • Checklist
  • Chrome OS
  • CI
  • Cloudflare
  • Command Line
  • Config
  • Container
  • CURL
  • Data
  • Docker
  • Emoji
  • EMQX
  • GIN
  • Git
  • Github
  • Gitlab
  • Go
  • Golang
  • Google
  • GraphQL
  • Infra
  • Infrastructure
  • Introduction
  • ITerm2
  • Kubernetes
  • Leetcode
  • Lightweight
  • Linux
  • Llm
  • Machinelearning
  • MacOS
  • MQTT
  • Network
  • Nginx
  • Ollama
  • Prometheus
  • Push
  • Python
  • Regex
  • Security
  • SFTP
  • SHELL
  • Slides
  • Snow
  • Software
  • Ssh
  • String
  • Switch
  • Synology
  • Terminal
  • Travel
  • Tunnel
  • URL
  • Video
  • Visualization
  • Web
  • Zero Trust
Hero Image
Nginx notes

Record Nginx configuration file and explanation. files structure . ├── geoip.conf ├── nginx.conf ├── sites-available │ ├── default.conf ├── sites-enabled │ ├── default.conf -> ../sites-available/default.conf ├── upstream.conf geoip.conf ## module: ngx_http_geoip2_module ## https://github.com/leev/ngx_http_geoip2_module ## 讀取 GeoIP 資料庫,並進行變數設定 geoip2 /usr/share/GeoIP/GeoLite2-Country.mmdb { auto_reload 60m; $geoip2_metadata_country_build metadata build_epoch; ## 自定義 $geoip2_data_country_code 值為 $remote_addr 對應的 ISO 3116 規範的國碼 $geoip2_data_country_code source=$remote_addr country iso_code; ## 自定義 $geoip2_data_country_name 值為對應的英文城市名 $geoip2_data_country_name country names en; } upstream.conf ## module: ngx_http_upstream_module ## 定義 server 組別 upstream to_nodejs1 { ## server address [parameters]; 定義 server ## parameters: ## weight=number 定義權重,預設為 1 ## max_fails=number 設定到 upstream server 的最大重試次數,預設為 1 ## fail_timeout=time 設定到達 max_fails 次數之後,暫停向此 upstream server 傳送請求的時間,預設為 10 秒 ## backup 標記此 upstream server 為備用,當其他 upstream server 不可用時,此 upstream server 可接受請求 ## down 標記此 upstream server 為不可用 server 10.

Friday, November 19, 2021 Read
Navigation
  • About
  • Skills
  • Experiences
  • Education
  • Projects
Contact me:
  • zeyanlin@outlook.com
  • linzeyan
  • Ricky
  • Ricky
  • Ricky