Skip to content

Instantly share code, notes, and snippets.

@nuhil
Last active September 19, 2019 05:35
Show Gist options
  • Save nuhil/d39e97edb9a2bd438538 to your computer and use it in GitHub Desktop.
Save nuhil/d39e97edb9a2bd438538 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
}
}
@alanee1996
Copy link

hi, im very new to nginx, where should i keep the config file and what should the config file place and name in my slim project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment