forked from arthurfurlan/nginx-config-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wordpress.conf
50 lines (41 loc) · 1.32 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
server {
server_name example.com www.example.com;
listen 80;
listen 443;
# canonical domain
include /srv/example.com/nginx/conf/canonical_domain.conf;
# wordpress root
set $wp_document_root '/usr/share/wordpress';
location / {
root $wp_document_root;
index index.php index.html index.htm;
# permalinks
try_files $uri $uri/ /index.php;
}
# wordpress admin (http auth)
location ~ /(wp-admin/.*|wp-login)\.php$ {
include /srv/example.com/nginx/conf/http_auth_basic.conf;
root $wp_document_root;
if (!-f $document_root$fastcgi_script_name) {
rewrite ^ 404;
}
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# wordpress non-admin pages
location ~ \.php$ {
root $wp_document_root;
if (!-f $document_root$fastcgi_script_name) {
rewrite ^ 404;
}
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# logging
error_log /srv/example.com/nginx/log/access.log;
access_log /srv/example.com/nginx/log/access.log;
}