Skip to content

Instantly share code, notes, and snippets.

@yuvilio
Created November 8, 2015 01:19
Show Gist options
  • Save yuvilio/bf1289a41e6f9b8a7492 to your computer and use it in GitHub Desktop.
Save yuvilio/bf1289a41e6f9b8a7492 to your computer and use it in GitHub Desktop.
nginx-fpm
server {
listen 80;
server_name www.example.dev;
root /home/yuvilio/ws/apps/php/wordpress/example;
index index.php index.html index.htm;
# serve static files more efficiently via caching. no need to log those requests
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
access_log off;
log_not_found off;
expires max;
add_header 'Access-Control-Allow-Origin' '*'; #cors
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
#app specific rewrites, when hitting the php script
}
#no direct file answering to that path? send it to php
# pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
location ~ \.php$ {
client_max_body_size 200m; # allow large image POSTS (used for uploading media)
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm.sock; #make sure 'listen = /var/run/php-fpm.sock' is in your php-fpm.conf file
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment