Answers for "nginx php single page application"

0

nginx php single page application

# For a single page PHP application add this inside of the server object
# WARNING: This will not work if you want to call different scripts
# depending on the request uri
location / {
        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_pass backend;
        fastcgi_param SCRIPT_FILENAME #put your absolute path to your entry ;
          							  #point here e.g. /var/www/html/index.php
}

# Outside of the server object you must define the following 
upstream backend {
    server unix:/var/run/php/php7.4-fpm.sock; #check your fpm sock path
}
# Beware that nginx -c might throw an error if your symlink is not in the
# sites-enabled folder yet (the error will be something like "upstream not
# allowed here"). That error occurs because the upstream object must be
# inside of an http object and the nginx.conf file (where the http object
# is defined) only includes all files inside of the enabled folder
Posted by: Guest on August-11-2021

Browse Popular Code Answers by Language