Skip to content

Instantly share code, notes, and snippets.

@armanm
Last active December 14, 2015 03:39
Show Gist options
  • Save armanm/5022374 to your computer and use it in GitHub Desktop.
Save armanm/5022374 to your computer and use it in GitHub Desktop.
Nginx config for PHP-FPM
server {
sendfile off;
listen 80 default;
server_name localhost;
client_max_body_size 10m;
access_log /var/log/nginx/localhost.access.log;
location / {
root /vagrant;
autoindex on;
index index.html index.htm index.php;
# if file exists return it right away
if (-f $request_filename){
break;
}
if (-e $request_filename){
break;
}
# Useful rewrite for most frameworks, wordpress
if (!-e $request_filename){
rewrite ^(.+)$ /index.php last;
break;
}
}
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~ \.php$ {
expires off;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /vagrant/$fastcgi_script_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment