Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

Commit e9940c1

Browse files
ildyriad7415
andauthored
Fix path being added to query string (#229)
* fix path being added to query string * fix the query string appearing in the url * Update default.conf Co-authored-by: Martin Stone <1611702+d7415@users.noreply.github.com> --------- Co-authored-by: Martin Stone <1611702+d7415@users.noreply.github.com>
1 parent 6ae2191 commit e9940c1

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

default.conf

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ http {
4949
server {
5050
root /var/www/html/Lychee/public;
5151
listen 80;
52+
listen [::]:80;
5253
server_name localhost;
5354
client_max_body_size 100M;
5455

55-
# serve static files directly
56-
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
56+
index index.php;
57+
58+
location = /favicon.ico {
59+
access_log off;
60+
log_not_found off;
61+
}
62+
location = /robots.txt {
5763
access_log off;
58-
expires max;
5964
log_not_found off;
6065
}
6166

@@ -65,35 +70,25 @@ http {
6570
rewrite ^/(.+)/$ /$1 permanent;
6671
}
6772

68-
# If the request is not for a valid file (image, js, css, etc.), send to bootstrap
69-
if (!-e $request_filename)
70-
{
71-
rewrite ^/(.*)$ /index.php?/$1 last;
72-
break;
73-
}
74-
7573
location / {
76-
index index.php
7774
try_files $uri $uri/ /index.php?$query_string;
7875
}
7976

80-
# Serve /index.php through PHP
81-
location = /index.php {
82-
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
83-
84-
try_files $uri $document_root$fastcgi_script_name =404;
77+
error_page 404 /index.php;
8578

79+
# Serve /index.php through PHP
80+
location ~ ^/index\.php(/|$) {
8681
# Mitigate https://httpoxy.org/ vulnerabilities
8782
fastcgi_param HTTP_PROXY "";
8883

89-
fastcgi_pass unix:/run/php/php8.4-fpm.sock;
90-
fastcgi_index index.php;
91-
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
84+
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
85+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
9286
fastcgi_param PHP_VALUE "post_max_size=100M
9387
max_execution_time=3600
9488
upload_max_filesize=100M
9589
memory_limit=256M";
9690
fastcgi_param PATH /usr/local/bin:/usr/bin:/bin;
91+
fastcgi_hide_header X-Powered-By;
9792
include fastcgi_params;
9893
}
9994

0 commit comments

Comments
 (0)