-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.com.conf
More file actions
60 lines (47 loc) · 1.86 KB
/
example.com.conf
File metadata and controls
60 lines (47 loc) · 1.86 KB
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
51
52
53
54
55
56
57
58
59
60
proxy_cache_path /var/cache/nginx/proxy_cache_dir/example.com levels=1:2 keys_zone=example.com:100m max_size=700m inactive=6h use_temp_path=off;
proxy_buffers 256 16k;
proxy_buffer_size 32k;
server {
listen 80;
listen [::]:80;
server_name example.com;
include snippets/letsencrypt.conf;
location / {
return 301 https://example.com\$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
access_log /var/log/nginx/example.com_access.log;
error_log /var/log/nginx/example.com_error.log;
server_name example.com;
root /var/www/html;
# SSL
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
# WordPress cookies (https://www.cookielawinfo.com/wordpress-cookies-list-why-they-are-used/)
if ($http_cookie ~* "wordpress_(?!test_cookie)|comment_author_" ) {
set $no_cache 1;
}
# URLs
if ($request_uri ~* "/wp-admin/|wp-.*.php|/feed/|/xmlrpc.php|sitemap(_index)?.xml") {
set $no_cache 1;
}
# reverse proxy
location / {
proxy_cache example.com;
proxy_cache_valid 200 304 6h;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_bypass $no_cache;
proxy_no_cache $no_cache;
proxy_cache_background_update on;
proxy_cache_lock on;
proxy_cache_key $scheme$host$uri;
proxy_ignore_headers Expires;
proxy_ignore_headers Cache-Control;
proxy_pass http://0.0.0.0:8080;
include snippets/proxy.conf;
}
}