location /style.css { try_files $uri $uri/ =404; } location ~ ^/(tree|index|blob|commit|commits)\.php { include /etc/nginx/fastcgi.conf; fastcgi_pass unix:/run/php-fpm/php-fpm.sock; } location / { rewrite ^/([^/]+)(/?)$ /tree.php?repo=$1; rewrite ^/([^/]+)/tree$ /tree.php?repo=$1; rewrite ^/([^/]+)/tree/([^/]*)(/?)$ /tree.php?repo=$1&object=$2; rewrite ^/([^/]+)/tree/([^/]*)/(.*)$ /tree.php?repo=$1&object=$2&path=$3; rewrite ^/([^/]+)/blob$ /blob.php?repo=$1; rewrite ^/([^/]+)/blob/([^/]*)(/?)$ /blob.php?repo=$1&object=$2; rewrite ^/([^/]+)/blob/([^/]*)/(.*)$ /blob.php?repo=$1&object=$2&path=$3; rewrite ^/([^/]+)/raw$ /blob.php?raw&repo=$1; rewrite ^/([^/]+)/raw/([^/]*)(/?)$ /blob.php?raw&repo=$1&object=$2; rewrite ^/([^/]+)/raw/([^/]*)/(.*)$ /blob.php?raw&repo=$1&object=$2&path=$3; rewrite ^/([^/]+)/commit$ /commit.php?repo=$1; rewrite ^/([^/]+)/commit/([^/]*)(/?)$ /commit.php?repo=$1&object=$2; rewrite ^/([^/]+)/commit/([^/]*)/(.*)$ /commit.php?repo=$1&object=$2&path=$3; rewrite ^/([^/]+)/commits$ /commits.php?repo=$1; rewrite ^/([^/]+)/commits/([^/]*)(/?)$ /commits.php?repo=$1&object=$2; rewrite ^/([^/]+)/commits/([^/]*)/(.*)$ /commits.php?repo=$1&object=$2&path=$3; try_files $uri $uri/ =404; }