FilydocのNginx設定

Filydocをnginxで動かす場合の設定です。

server {
    listen       80;
    server_name  {server_name};

    root         /var/www/vhosts/filydoc;

    location / {
        index index.php index.cgi index.html index.htm;
        if ($request_filename !~ \.(png|gif|jpg|jpeg|css|js|tgz|tar\.gz|zip)$) {
            rewrite ^(.*)$ /index.php last;
        }
    }

    location ~ \.(sql|md)$ {
        deny all;
    }

    location 403.html {
        deny all;
    }

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

}