Skip to content

Commit

Permalink
Directing all traffic to the public/index.php router
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolvverine committed Apr 16, 2024
1 parent 2e3e0f3 commit 62679fd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8
3.8.1
51 changes: 28 additions & 23 deletions root/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ http {
client_body_buffer_size 128k;

## DIRECTORY
root /var/www;
root /var/www/public;
index index.php;

## LOCATION
# Correctly route requests to index.php if the requested file or directory does not exist
location / {
try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}

# Redirect all /plugins/fusioninventory/ requests to /front/inventory.php - native only inventory
Expand Down Expand Up @@ -120,29 +121,33 @@ http {
fastcgi_intercept_errors on;
}

# Explicitly handle requests to index.php, ensuring fastcgi parameters are correctly passed
location ~ ^/index\.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

# Explicitly handle requests to *.php, ensuring fastcgi parameters are correctly passed
location ~ [^/]\.php(/|$) {
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# location ~ [^/]\.php(/|$) {
# # regex to split $uri to $fastcgi_script_name and $fastcgi_path
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # Check that the PHP script exists before passing it
# try_files $fastcgi_script_name =404;
# include fastcgi_params;
# # Bypass the fact that try_files resets $fastcgi_path_info
# # # see: http://trac.nginx.org/nginx/ticket/321
# set $path_info $fastcgi_path_info;

# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;

include fastcgi_params;

# Bypass the fact that try_files resets $fastcgi_path_info
# # see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;

fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SERVER_NAME $host;

# allow directory index
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php-fpm.sock;
}
# fastcgi_param PATH_INFO $path_info;
# fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param SERVER_NAME $host;
# # allow directory index
# fastcgi_index index.php;
# fastcgi_pass unix:/var/run/php-fpm.sock;
# }

# deny access to some ressources
location ~ /(config|files)/ {
Expand Down

0 comments on commit 62679fd

Please sign in to comment.