1# For a single page PHP application add this inside of the server object
2# WARNING: This will not work if you want to call different scripts
3# depending on the request uri
4location / {
5 include fastcgi_params;
6 fastcgi_index index.php;
7 fastcgi_pass backend;
8 fastcgi_param SCRIPT_FILENAME #put your absolute path to your entry ;
9 #point here e.g. /var/www/html/index.php
10}
11
12# Outside of the server object you must define the following
13upstream backend {
14 server unix:/var/run/php/php7.4-fpm.sock; #check your fpm sock path
15}
16# Beware that nginx -c might throw an error if your symlink is not in the
17# sites-enabled folder yet (the error will be something like "upstream not
18# allowed here"). That error occurs because the upstream object must be
19# inside of an http object and the nginx.conf file (where the http object
20# is defined) only includes all files inside of the enabled folder
1#add in one or more server {} locations
2
3location ~ \.php$ {
4 try_files $uri =404;
5 fastcgi_split_path_info ^(.+\.php)(/.+)$;
6 fastcgi_pass 127.0.0.1:9000;
7 fastcgi_index index.php;
8 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_sc$
9 fastcgi_buffers 256 128k;
10 fastcgi_connect_timeout 300s;
11 fastcgi_send_timeout 300s;
12 fastcgi_read_timeout 300s;
13 include fastcgi_params;
14 fastcgi_param PHP_VALUE "upload_max_filesize = 256M \n post_max_size=256M \n max_input_vars=1000000";
15}