-
-
Save wezoalves/2998510 to your computer and use it in GitHub Desktop.
Zend with nginx
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
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