Logo Ricky
  • Home
  • About
  • More
    Skills Experiences Education Projects
  • Posts
  • Notes
  • Activities
  • Transform
  • English
    English Chinese
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • Tags
  • A10
  • ACME
  • AD
  • AES
  • AI
  • Aliyun
  • Ansible
  • APP
  • Application Delivery Controller
  • Arceus
  • Argo CD
  • ASCII
  • Authentication
  • Authorization
  • AWS
  • BASH
  • Bayonet
  • Benchmark
  • BGP
  • BIRD
  • Board Game
  • Browser
  • Byte
  • Cache
  • CDN
  • Channel
  • Chart
  • Checklist
  • Chrome
  • Chrome OS
  • Chrony
  • CI
  • Cilium
  • Cisco
  • Cloud-Native
  • Cloudflare
  • Cluster
  • Command Line
  • Completion
  • Config
  • Container
  • CPU
  • CURL
  • Data
  • Database
  • Debug
  • Dehydrated
  • Design
  • DevSecOps
  • Diagrams
  • Dmg
  • DNS
  • DNS-01
  • Docker
  • EFF
  • ElasticSearch
  • ELK
  • Emoji
  • EMQX
  • Encode
  • Encrypt
  • ESXi
  • Extension
  • Firewall
  • Fortigate
  • Fortinet
  • FortiOS
  • Game
  • GeoIP
  • GIN
  • Git
  • GitBook
  • Github
  • Gitlab
  • GitOps
  • Gluetun
  • Go
  • Go-Mysql-Elasticsearch
  • Golang
  • Google
  • GPG
  • GraphQL
  • HA
  • HAProxy
  • Hash
  • HomeLab
  • Htop
  • HTTP
  • Infra
  • Infrastructure
  • Input Method
  • Interview
  • Introduction
  • IPhone
  • Iptables
  • Iso
  • Issue
  • ITerm2
  • Jenkins
  • Jsoniter
  • Juniper
  • JWT
  • Kibana
  • Kubernetes
  • LDAP
  • Leetcode
  • Lightweight
  • Linkerd
  • Linux
  • LLM
  • Log
  • Lua
  • Lullaby
  • LVM
  • Machinelearning
  • MacOS
  • Markdown
  • Mattermost
  • Mermaid
  • MinIO
  • Module
  • MQTT
  • MSS
  • MTU
  • Music
  • MyDumper
  • MySQL
  • NAS
  • Netcat
  • Network
  • Nftables
  • Nginx
  • OAuth
  • OIDC
  • Ollama
  • OpenResty
  • Parquet
  • Percona
  • Pinyin
  • Pip
  • Plugin
  • Pokemon
  • PowerDNS
  • PowerShell
  • Pprof
  • Principle
  • Prometheus
  • Protobuf
  • Proxy
  • Push
  • Python
  • QRCode
  • R
  • RAID
  • RDP
  • Redis
  • Regex
  • Ringtone
  • Route
  • Rust
  • S3
  • ScreenShot
  • Security
  • Selenium
  • Sentry
  • Service Mesh
  • SFTP
  • SHELL
  • Slides
  • Snow
  • Software
  • SonarQube
  • SQL
  • SSH
  • SSL
  • String
  • Switch
  • Sync
  • Synology
  • System
  • Tcpdump
  • Telegram
  • Terminal
  • Terraform
  • Test
  • Testing
  • Time
  • Timeout
  • TLS
  • Tor
  • Trace
  • Traefik
  • Travel
  • Tunnel
  • Typora
  • Ubuntu
  • URL
  • UserAgent
  • V2Ray
  • Vagrant
  • Video
  • Vim
  • Virtualization
  • Visualization
  • VNC
  • VPN
  • VSCode
  • WAF
  • Web
  • WebAssembly
  • Webp
  • Windows
  • WSL
  • YAML
  • Youtube
  • Zabbix
  • Zero Trust
  • Zim
  • ZSH
  • 台語
Hero Image
使用 Nginx 和 mod_pagespeed 自动将图片转换为 WebP 并输出

使用 Nginx 和 mod_pagespeed 自动将图片转换为 WebP 并输出 编译 ngx_pagespeed 首先确保 Nginx 有 --with-compat 编译参数,这样我们就不需要按照一些奇怪的教程让大家从头开始编译 Nginx incubator: https://github.com/apache/incubator-pagespeed-ngx.git # 切换到 nginx 源代码目录下开始配置编译环境 ./configure --with-compat --add-dynamic-module=../incubator-pagespeed-ngx # 编译 modules make modules # 将对应编译好的 module 放到 nginx 目录下: sudo cp objs/ngx_pagespeed.so /etc/nginx/modules/ # 创建好缓存文件夹以便存放自动转换的图片 sudo mkdir -p /var/ngx_pagespeed_cache sudo chown -R www-data:www-data /var/ngx_pagespeed_cache load_module modules/ngx_pagespeed.so; # enable pagespeed module on this server block pagespeed on; # Needs to exist and be writable by nginx. Use tmpfs for best performance. pagespeed FileCachePath /var/ngx_pagespeed_cache; # Ensure requests for pagespeed optimized resources go to the pagespeed handler # and no extraneous headers get set. location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; } location ~ "^/pagespeed_static/" { } location ~ "^/ngx_pagespeed_beacon$" { } pagespeed RewriteLevel CoreFilters; 其中最后一个部分(pagespeed RewriteLevel CoreFilters;)表示启用的优化方式,其中包括了一些基础的优化,比如

Monday, October 7, 2019 Read
Navigation
  • About
  • Skills
  • Experiences
  • Education
  • Projects
Contact me:
  • zeyanlin@outlook.com
  • linzeyan
  • Ricky
  • Ricky