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>
38 lines
1.1 KiB
Nginx Configuration File
38 lines
1.1 KiB
Nginx Configuration File
# Basic nginx config for tkr in subfolder
|
|
# e.g. https://your-domain.com/tkr
|
|
# Add this location block to your existing server configuration
|
|
|
|
location /tkr {
|
|
alias /var/www/tkr/public;
|
|
index index.php;
|
|
|
|
# Handle PHP files
|
|
location ~ \.php$ {
|
|
fastcgi_pass unix:/run/php/php8.2-fpm.sock; # Adjust PHP version/socket as needed
|
|
fastcgi_param SCRIPT_FILENAME /var/www/tkr/public/index.php;
|
|
include fastcgi_params;
|
|
}
|
|
|
|
# Block access to sensitive directories
|
|
location ~ ^/tkr/(storage|src|templates|config) {
|
|
deny all;
|
|
return 404;
|
|
}
|
|
|
|
# Block access to hidden files
|
|
location ~ /\. {
|
|
deny all;
|
|
}
|
|
|
|
# Front controller pattern
|
|
try_files $uri $uri/ @tkr;
|
|
}
|
|
|
|
location @tkr {
|
|
fastcgi_pass unix:/run/php/php8.2-fpm.sock; # Adjust PHP version as needed
|
|
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;
|
|
} |