Skip to content

Instantly share code, notes, and snippets.

@VirtuBox
Created December 14, 2018 17:55
Show Gist options
  • Save VirtuBox/9e485a800a460b1a1631d46159967171 to your computer and use it in GitHub Desktop.
Save VirtuBox/9e485a800a460b1a1631d46159967171 to your computer and use it in GitHub Desktop.
Nginx PHP upstream
http {
---
# php upstream
upstream php {
server unix:/var/run/php/php7.2-fpm.sock;
}
---
server {
server_name yourdomain.tld;
root /var/www/yoursite.tld/htdocs;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
# pass request to php upstream
# if file exist
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment