Update README for CDN specifications.

This commit is contained in:
n0vad3v 2020-03-17 20:32:56 +08:00
parent cb4beb54f7
commit 3f7f7a5cf2
No known key found for this signature in database
GPG Key ID: 8D42A0E699E50639

View File

@ -112,10 +112,17 @@ docker run -d -p 3333:3333 -v /path/to/pics:/opt/pics --name webps webpsh/webps
The path `path/to/pics` is your images serving in local. The path `/opt/pics` unable modify because it define in the `config.json` when building docker image. The cache folder of `EXHAUST_PATH` default define in `/opt/exhaust` , you can also mount the local dir for the cache folder by using `-v /path/to/exhaust:/opt/exhaust` option. The path `path/to/pics` is your images serving in local. The path `/opt/pics` unable modify because it define in the `config.json` when building docker image. The cache folder of `EXHAUST_PATH` default define in `/opt/exhaust` , you can also mount the local dir for the cache folder by using `-v /path/to/exhaust:/opt/exhaust` option.
### 4. Nginx proxy_pass ### 4. Nginx proxy_pass
Let Nginx to `proxy_pass http://localhost:3333/;`, and your webp-server is on-the-fly Let Nginx to `proxy_pass http://localhost:3333/;`, and your webp-server is on-the-fly.
#### WordPress example
#### CDN Problem
If you use CDN(such as Cloudflare) for your website, we'd recommend you to add a `no-cache` header like the example below, this will prevent your images from being cached and webp images rendered to Safari users(which will of course cause some troubles).
#### Nginx example
This is an example for a typical Wordpress installation.
``` ```
location ^~ /wp-content/uploads/ { location ^~ /wp-content/uploads/ {
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
proxy_pass http://127.0.0.1:3333; proxy_pass http://127.0.0.1:3333;
} }
``` ```