Skip to content

Instantly share code, notes, and snippets.

@davinderpalrehal
Last active November 3, 2019 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davinderpalrehal/dd8892255905f3b7cc5db4d38f01cf2d to your computer and use it in GitHub Desktop.
Save davinderpalrehal/dd8892255905f3b7cc5db4d38f01cf2d to your computer and use it in GitHub Desktop.
Nginx configuration to work with PHP
server {
# Using port 8080 only for testing purposes
listen 8080 default_server;
listen [::]:8080 default_server;
# Where are the files that are being served
root /srv/www/html;
# Default Index file being served, have added `index.php`
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# Added support for PHP routers
try_files $uri $uri/ /index.php?args =404;
}
# Adding support for PHP7.3
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# Adding environmental variables for this website
include /srv/config/default.nginx.conf;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment