Skip to content

Instantly share code, notes, and snippets.

@elchappo
Created October 20, 2012 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elchappo/3925117 to your computer and use it in GitHub Desktop.
Save elchappo/3925117 to your computer and use it in GitHub Desktop.
PHP nginx configration
server{
listen 80;
server_name <domine>;
access_log /var/log/<domine>.access_log;
error_log /var/log/<domine>.error_log;
root <domine_path>;
location ~ ^/resize/([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ {
try_files $uri @resize;
expires 4h;
}
location / {
expires 4h;
}
location ~ \.php(.*)$ {
try_files $uri = 404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
}
location @resize {
rewrite ^/resize/([0-9]+)/([0-9]+)/([0-9]+)/(.*)? /resize.php?width=$1&hight=$2&mode=$3&path=$4;
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_pass 127.0.0.1:8000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment