updated to use router.php from https://phprouter.com/

This commit is contained in:
root
2025-01-05 14:49:32 +00:00
parent 54e89ac57d
commit a091a52d7b
3 changed files with 43 additions and 10 deletions

View File

@@ -2,15 +2,37 @@ server {
index index.php index.html index.htm;
listen 80;
listen [::]:80;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
root /app;
charset utf-8;
#This is a rewrite rule. It is telling nginx to try to find the file in the root directory. If it can't find it, it will try to find it in the root directory with a trailing slash. If it can't find it there, it will try to find it in the routes.php file.
location / {
try_files $uri $uri/ /routes.php?$query_string;
}
error_page 404 /routes.php;
location routes.php {
}
#This is telling nginx to return a 404 error if it finds a php file.
location ~ \.php {
return 404;
}
location ~ (\.png|\.jpg|\.gif|\.jpeg|\.zip|\.css|\.svg|\.js)$ {
}
location = /routes.php {
try_files $uri /routes.php?$query_string;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index routes.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
server_name bsapi.home.brynstuff.co.uk;
}