Skip to content

Instantly share code, notes, and snippets.

@wezoalves
Forked from carlosfilho88/nginx.conf
Created June 26, 2012 20:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wezoalves/2998510 to your computer and use it in GitHub Desktop.
Save wezoalves/2998510 to your computer and use it in GitHub Desktop.
Zend with nginx
server {
listen 80;
server_name www.zf.local zf.local;
index /index.php;
charset utf-8;
root "/home/workspace/zf/public";
access_log /var/log/nginx/zf/access.log;
error_log /var/log/nginx/zf/error.log;
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
return 204;
access_log off;
log_not_found off;
}
location ~* \.(ico|css|js|gif|jpg|jpeg|png|swf|pdf|html)$ {
access_log off;
log_not_found off;
expires 10s; #1h;
break;
}
location = /robots.txt {
rewrite (.*) /robots/robots.txt;
break;
}
location = /sitemap.xml {
rewrite (.*) /downloads/sitemap.xml;
break;
}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
if ($http_user_agent ~* LWP::Simple|BBBike|wget|msnbot|scrapbot|Baiduspider|Jullo) {
return 403;
}
location / {
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
if (!-f $request_filename) {
break;
}
keepalive_requests 100;
rewrite ^/(.*)/$ /$1 break;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_ignore_client_abort on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment