aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/doc/nginx.conf
blob: d2efa46dcfbff14dbf33fe797ed2a6e64dfb735b (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
server {
    listen 80;
    server_name localhost;

    root   /srv/http;
    index  index.php;

    # This catches requests other than /CGP/rrd/ and PHP (see below)
    location /CGP/ {
        gzip on;
        gzip_types "application/javascript text/css";
        # The static files do not change often, cache hint 1 month
        expires 1M;
    }

    # Assume that CGP is located at /srv/http/CGP/, directly serve the RRD data
    # files for use with the canvas graph type. Add compression to reduce data
    # usage by 70% - 80%.
    location /CGP/rrd/ {
        alias /var/lib/collectd/rrd/;
        gzip on;
        gzip_types "*";
        # Cache hint: browser can recheck after 10 minutes
        expires 10m;
        #gzip_comp_level 3;
    }

    # Process PHP files through PHP-FPM
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass   unix:/run/php5-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # Disallow access to hidden files and directories (such as .git/)
    location ~ /\. {
        deny all;
    }
}