# Example nginx configuration for TorrentPier

server {
    listen 80;
    server_name example.com;
    root /path/to/www;
    index index.php;
    charset utf-8;

    location / {
        try_files \$uri \$uri/ /index.php?\$args;
    }

    location ~ \/(install|internal_data|library)\/ {
        return 404;
    }

    location ~ /\.(ht|en) {
        return 404;
    }

    location ~ /\.git {
        return 404;
    }

    location ~ \.(.*sql|tpl|db|inc|log|md)$ {
        return 404;
    }

    rewrite ^/sitemap.xml$ /sitemap/sitemap.xml;

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass unix:/run/php/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
        include fastcgi_params;
    }
}
