tkr/docker/nginx/root/nginx.conf
Greg Sarjeant 86abf587f6 simplify web server configs (#65)
Reviewed-on: https://gitea.subcultureofone.org/greg/tkr/pulls/65
Co-authored-by: Greg Sarjeant <greg@subcultureofone.org>
Co-committed-by: Greg Sarjeant <greg@subcultureofone.org>
2025-08-10 22:13:45 +00:00

46 lines
1.1 KiB
Nginx Configuration File

# Basic nginx config for tkr
# Replace "your-domain.com" with your actual domain
# Replace "/var/www/tkr" with your installation path
# HTTP - redirect to HTTPS
server {
listen 80 default_server;
server_name localhost;
root /var/www/tkr/public;
index index.php;
# Block access to sensitive directories
location ~ ^/(storage|src|templates|config) {
deny all;
return 404;
}
# Block access to hidden files
location ~ /\. {
deny all;
}
# Handle PHP files
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_param SCRIPT_FILENAME /var/www/tkr/public/index.php;
include fastcgi_params;
}
# Front controller pattern - route everything else through index.php
location / {
try_files $uri $uri/ @tkr;
}
# Handle PHP requests
location @tkr {
fastcgi_pass php:9000;
fastcgi_param SCRIPT_FILENAME /var/www/tkr/public/index.php;
include fastcgi_params;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param QUERY_STRING $query_string;
}
}