Last active
September 19, 2019 05:35
-
-
Save nuhil/d39e97edb9a2bd438538 to your computer and use it in GitHub Desktop.
Nginx Configuration for Slim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
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?