aboutsummaryrefslogtreecommitdiff
path: root/nginx.conf
blob: 34be30da34f2f074dc7855a565a5dc055e1db233 (plain) (blame)
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
server {
    listen 8009;
    server_name www.xn--trdgrdstomten-cfbr.se;
    return 301 https://xn--trdgrdstomten-cfbr.se$request_uri;
}

server {
    listen            8009 default_server;
    server_name       xn--trdgrdstomten-cfbr.se;
    root              /var/www/trädgårdstomten/public;
    rewrite           ^/([^/]+/)*[^.]+[^/]$ $http_x_forwarded_proto://$host$request_uri/ permanent;
    set_real_ip_from  127.0.0.1/8;
    gzip on;
    default_type "text/html";

    location / {
        index          index.php;
        try_files      $uri $uri/ @extless-php;
    }

    location ~ \.php$ {
        fastcgi_pass   php:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location @extless-php {
        rewrite ^(/.*)/$ $1;
        if (-f $document_root$uri.php) {
            rewrite ^ $uri.php last;
        }
        return 404;
    }
}