Остання активність 6 hours ago

awyme's Avatar awyme ревизій цього gist 6 hours ago. До ревизії

1 file changed, 86 insertions

wordpress-w3tc-site.conf(файл створено)

@@ -0,0 +1,86 @@
1 + server {
2 + # Redirect yoursite.com to www.yoursite.com
3 + server_name yoursite.com;
4 + rewrite ^(.*) http://www.yoursite.com$1 permanent;
5 + }
6 +
7 + server {
8 +
9 + # Tell nginx to handle requests for the www.yoursite.com domain
10 + server_name www.yoursite.com;
11 + index index.php index.html index.htm;
12 + root /srv/www/yoursite.com/public;
13 + access_log /srv/www/yoursite.com/logs/access.log;
14 + error_log /srv/www/yoursite.com/logs/error.log;
15 +
16 + # Use gzip compression
17 + # gzip_static on; # Uncomment if you compiled Nginx using --with-http_gzip_static_module
18 + gzip on;
19 + gzip_disable "msie6";
20 + gzip_vary on;
21 + gzip_proxied any;
22 + gzip_comp_level 5;
23 + gzip_buffers 16 8k;
24 + gzip_http_version 1.0;
25 + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/png image/gif image/jpeg;
26 +
27 + # Rewrite minified CSS and JS files
28 + location ~* \.(css|js) {
29 + if (!-f $request_filename) {
30 + rewrite ^/wp-content/w3tc/min/(.+\.(css|js))$ /wp-content/w3tc/min/index.php?file=$1 last;
31 + # Use the following line instead for versions of W3TC pre-0.9.2.2
32 + # rewrite ^/wp-content/w3tc/min/([a-f0-9]+)\/(.+)\.(include(\-(footer|body))?(-nb)?)\.[0-9]+\.(css|js)$ /wp-content/w3tc/min/index.php?tt=$1&gg=$2&g=$3&t=$7 last;
33 + }
34 + }
35 +
36 + # Set a variable to work around the lack of nested conditionals
37 + set $cache_uri $request_uri;
38 +
39 + # POST requests and urls with a query string should always go to PHP
40 + if ($request_method = POST) {
41 + set $cache_uri 'no cache';
42 + }
43 + if ($query_string != "") {
44 + set $cache_uri 'no cache';
45 + }
46 +
47 + # Don't cache uris containing the following segments
48 + if ($request_uri ~* "(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|wp-.*\.php|index\.php|wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php)") {
49 + set $cache_uri "no cache";
50 + }
51 +
52 + # Don't use the cache for logged in users or recent commenters
53 + if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp\-postpass|wordpress_logged_in") {
54 + set $cache_uri 'no cache';
55 + }
56 +
57 + # Use cached or actual file if they exists, otherwise pass request to WordPress
58 + location / {
59 + try_files /wp-content/w3tc/pgcache/$cache_uri/_index.html $uri $uri/ /index.php?q=$uri&$args;
60 + }
61 +
62 + # Cache static files for as long as possible
63 + location ~* \.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
64 + try_files $uri =404;
65 + expires max;
66 + access_log off;
67 + }
68 +
69 + # Deny access to hidden files
70 + location ~* /\.ht {
71 + deny all;
72 + access_log off;
73 + log_not_found off;
74 + }
75 +
76 + # Pass PHP scripts on to PHP-FPM
77 + location ~* \.php$ {
78 + try_files $uri /index.php;
79 + fastcgi_index index.php;
80 + fastcgi_pass 127.0.0.1:9000;
81 + include fastcgi_params;
82 + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
83 + fastcgi_param SCRIPT_NAME $fastcgi_script_name;
84 + }
85 +
86 + }
Новіше Пізніше