summarylogtreecommitdiffstats
path: root/nginx.conf
blob: b5be47ba361c759954b1a72f377e641fb8d772da (plain)
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
# pimpmylog.conf
# nginx config include for a local virtual host for PimpMyLog

# Copyright 2014 James An

# THIS PROGRAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

server {
  access_log  /var/log/nginx/pimpmylog.access.log;
  error_log   /var/log/nginx/pimpmylog.error.log;

  include       fastcgi_params;
  fastcgi_param MAIN_SITE_NAME pimpmylog.lacolhost.com;
  set           $main_site_name "pimpmylog.lacolhost.com";
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  listen        *:80;
  server_name   pimpmylog.lacolhost.com;
  root          /usr/share/webapps/pimpmylog;

  location ~* \.php$ {
    add_header    X-Speed-Cache "$upstream_cache_status";
    add_header    X-Speed-Cache-UID "$cache_uid";
    add_header    X-Speed-Cache-Key "$key_uri";
    add_header    X-NoCache "$nocache_details";
    add_header    X-This-Proto "$http_x_forwarded_proto";
    add_header    X-Server-Name "$main_site_name";
    add_header    Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
    tcp_nopush    off;
    keepalive_requests 0;
    try_files     $uri =404; ### check for existence of php file first
    fastcgi_pass  127.0.0.1:9000;
    ###
    ### Use Nginx cache for all visitors.
    ###
    set $nocache "";
    if ( $nocache_details ~ (?:AegirCookie|Args|Skip) ) {
      set $nocache "NoCache";
    }
    fastcgi_cache speed;
    fastcgi_cache_methods GET HEAD; ### Nginx default, but added for clarity
    fastcgi_cache_min_uses 1;
    fastcgi_cache_key "$is_bot$device$host$request_method$key_uri$cache_uid$http_x_forwarded_proto$sent_http_x_local_proto$cookie_respimg";
    fastcgi_cache_valid 200 10s;
    fastcgi_cache_valid 302 1m;
    fastcgi_cache_valid 301 403 404 5s;
    fastcgi_cache_valid 500 502 503 504 1s;
    fastcgi_ignore_headers Cache-Control Expires;
    fastcgi_pass_header Set-Cookie;
    fastcgi_pass_header X-Accel-Expires;
    fastcgi_pass_header X-Accel-Redirect;
    fastcgi_no_cache $cookie_NoCacheID $http_authorization $http_pragma $nocache;
    fastcgi_cache_bypass $cookie_NoCacheID $http_authorization $http_pragma $nocache;
    fastcgi_cache_use_stale error http_500 http_503 invalid_header timeout updating;
  }
}