Created
September 12, 2023 06:41
-
-
Save ilzrv/3a53ca95d09ccc98309b3dba20e345a0 to your computer and use it in GitHub Desktop.
A special version of PHP for a specific IP address via NGINX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream php_fpm_9000 { | |
server 127.0.0.1:9000; | |
} | |
upstream php_fpm_9001 { | |
server 127.0.0.1:9001; | |
} | |
server { | |
listen 80; | |
server_name domain.test; | |
root "/var/www/php/public"; | |
index index.html index.htm index.php; | |
set $upstream_name 'php_fpm_9000'; | |
if ($remote_addr = 109.109.109.109) { | |
set $upstream_name 'php_fpm_9001'; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass $upstream_name; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_intercept_errors off; | |
fastcgi_buffer_size 16k; | |
fastcgi_buffers 4 16k; | |
fastcgi_connect_timeout 300; | |
fastcgi_send_timeout 300; | |
fastcgi_read_timeout 300; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment