-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite.nginx.conf
65 lines (50 loc) · 1.74 KB
/
site.nginx.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
upstream SITE_COM_backend {
server unix:/var/run/php-fpm.SITEDOTCOM.sock1 weight=100 max_fails=5 fail_timeout=5;
server unix:/var/run/php-fpm.SITEDOTCOM.sock2 weight=100 max_fails=5 fail_timeout=5;
}
server {
listen 80 default_server;
server_name _;
root /var/www/SITEDOTCOM/WEBROOTPATH;
index index.php index.html;
access_log /var/www/SITEDOTCOM/DockerLocal/logs/access.log;
error_log /var/www/SITEDOTCOM/DockerLocal/logs/error.log warn;
include /etc/nginx/conf/mod_pagespeed.conf;
location ~ /themes/.*?\.php$ {
return 404;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
set $skip_cache 0;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
# Dont cache uris containing the following segments
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
set $skip_cache 1;
}
# Dont use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set $skip_cache 1;
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass SITE_COM_backend;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache microcache;
fastcgi_cache_valid 5m;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|woff)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
}