-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wordpress.conf
132 lines (103 loc) · 2.99 KB
/
wordpress.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
server {
listen [::]:443;
listen *:443 ssl http2;
server_name wordpress.sample;
root /usr/share/nginx/sites/wordpress/web/;
index index.php;
# SSL
ssl_certificate /etc/letsencrypt/live/wordpress.sample/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/wordpress.sample/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/wordpress.sample/chain.pem;
include /etc/nginx/snippets/ssl-params.conf;
access_log /var/log/nginx/access.wordpress.sample.log nginx_amplify;
error_log /var/log/nginx/error.wordpress.sample.log;
# Uncomment one of the lines below for the appropriate caching plugin (if used).
include /etc/nginx/snippets/wordpress/restrictions.conf;
include /etc/nginx/snippets/wordpress/wordpress-seo.conf;
include /etc/nginx/snippets/wordpress/wp-super-cache.conf;
# Dynamic cache
location ~* .(?:manifest|appcache|htm?|xml|json|map|html|htm|service-worker.js)$ {
gzip on;
gzip_static on;
brotli on;
brotli_static on;
gzip_vary on;
expires -1;
log_not_found off;
access_log off;
if_modified_since off;
include /etc/nginx/snippets/cors.conf;
}
# Feed
location ~* \.(?:rss|atom)$ {
expires 1h;
log_not_found off;
access_log off;
more_set_headers 'Cache-Control: public';
include /etc/nginx/snippets/cors.conf;
}
# Asset cache
location ~* .(svg|svgz|eot|otf|woff|woff2|ttf|css|js|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar)$ {
gzip on;
gzip_static on;
brotli on;
brotli_static on;
gzip_vary on;
expires modified +1y;
log_not_found off;
access_log off;
more_set_headers 'Cache-Control: public';
include /etc/nginx/snippets/cors.conf;
}
# Compressed asset cache
location ~* .(ogg|ogv|mp4|jpg|jpeg|gif|png|ico|mid|midi|wav|bmp)$ {
gzip off;
gzip_static off;
brotli off;
brotli_static off;
gzip_vary off;
expires modified +1y;
log_not_found off;
access_log off;
more_set_headers 'Cache-Control: public';
include /etc/nginx/snippets/cors.conf;
}
# PHP-FPM
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm-wordpress.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
}
location ~ ^/.well-known {
allow all;
}
}
server {
listen [::]:443;
listen *:443 ssl http2;
server_name www.wordpress.sample;
# SSL
ssl_certificate /etc/letsencrypt/live/www.wordpress.sample/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.wordpress.sample/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/www.wordpress.sample/chain.pem;
return 301 https://wordpress.sample$request_uri;
access_log /dev/null;
error_log /dev/null crit;
}
server {
listen *:80;
server_name wordpress.sample;
return 301 https://wordpress.sample$request_uri;
access_log /dev/null;
error_log /dev/null crit;
}
server {
listen *:80;
server_name www.wordpress.sample;
return 301 https://www.wordpress.sample$request_uri;
access_log /dev/null;
error_log /dev/null crit;
}