Skip to content

Commit

Permalink
chore: fix api
Browse files Browse the repository at this point in the history
  • Loading branch information
chrootlogin committed Sep 30, 2024
1 parent 2543906 commit 200a87c
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions freshrss/root/etc/nginx/nginx-freshrss.conf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,39 @@ http {
try_files $uri $uri/ =404;
}

# Location block for handling PHP files in /api with PATH_INFO
location ~ ^/api/.*\.php(/|$) {
# Disable caching for PHP files
expires off;

# Split the URI to extract script filename and path info
fastcgi_split_path_info ^(.+\.php)(/.*)$;

# Check that the script file exists
try_files $fastcgi_script_name =404;

# 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;

# Set the script filename parameter for PHP
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

# Pass the client's IP address to PHP
fastcgi_param CONN_REMOTE_ADDR $remote_addr;

# Include default FastCGI parameters
include fastcgi_params;

# Set error handling
fastcgi_intercept_errors on;
fastcgi_read_timeout 300;

# Pass the request to PHP-FPM
fastcgi_pass php-fpm;
}

# Handling PHP scripts
location ~ \.php$ {
# Disable caching for PHP files
Expand All @@ -88,15 +121,15 @@ http {
# Try to serve the file directly, fallback to 404
try_files $fastcgi_script_name =404;

# Set up FastCGI parameters
include fastcgi_params;

# Set the script filename parameter for PHP
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

# Pass the client's IP address to PHP
fastcgi_param CONN_REMOTE_ADDR $remote_addr;

# Set up FastCGI parameters
include fastcgi_params;

# Set error handling
fastcgi_intercept_errors on;
fastcgi_read_timeout 300;
Expand Down

0 comments on commit 200a87c

Please sign in to comment.