-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.conf
50 lines (37 loc) · 1.56 KB
/
server.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
proxy_cache_path /var/cache/wpcache levels=2:2 keys_zone=wpcache:120m inactive=14d max_size=5120m;
proxy_temp_path /var/cache/wpcache/tmp;
resolver 8.8.8.8 4.2.2.2;
log_format wpcache '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$upstream_cache_status" "$host" "$http_range"';
server {
listen 10.0.0.1 default;
server_name wpcache.host;
access_log /var/log/nginx/wpcache-access.log wpcache;
error_log /var/log/nginx/wpcache-error.log;
proxy_cache wpcache;
proxy_cache_key "$server_name$request_uri";
proxy_cache_bypass $arg_nocache;
proxy_cache_lock on;
proxy_cache_lock_timeout 1h;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_cache_revalidate on;
proxy_cache_valid 200 30d;
proxy_cache_valid 301 302 0;
proxy_max_temp_file_size 1024m;
proxy_next_upstream error timeout http_404;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_ignore_client_abort on;
proxy_ignore_headers "Expires" "Cache-Control";
add_header X-Upstream-Status $upstream_status;
add_header X-Upstream-Response-Time $upstream_response_time;
add_header X-Upstream-Cache-Status $upstream_cache_status;
location /themes/download/ {
proxy_pass "https://wordpress.org$request_uri";
proxy_set_header Host wordpress.org;
}
location / {
proxy_pass "https://downloads.wordpress.org$request_uri";
proxy_set_header Host downloads.wordpress.org;
}
}