Skip to content

Instantly share code, notes, and snippets.

@yrsdi
Forked from nuhil/mysite.com
Created September 19, 2019 05:35
Show Gist options
  • Select an option

  • Save yrsdi/ceecb95bbc9c3febe8ed2a3d684727a7 to your computer and use it in GitHub Desktop.

Select an option

Save yrsdi/ceecb95bbc9c3febe8ed2a3d684727a7 to your computer and use it in GitHub Desktop.
Nginx Configuration for Slim
# Assume that inside the 'Slim' directory,
# there is another directory named 'api' inside which there is the index.php file
# '/home/vagrant/Code/' is simply a synched folder from host machine to this directory
server {
listen 80;
server_name www.mysite.com mysite.com;
root /home/vagrant/Code/Slim;
try_files $uri /api/index.php;
# this will only pass index.php to the fastcgi process which is generally safer but
# assumes the whole site is run via Slim.
location /api/index.php {
fastcgi_connect_timeout 3s; # default of 60s is just too long
fastcgi_read_timeout 10s; # default of 60s is just too long
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000; # assumes you are running php-fpm locally on port 9000
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment