server {
listen 80;
server_name wenda.localhost.com;
index index.php;
root /mysite/wenda;
# 设置expires和max-age的时间
location ~* "^.+\.(jpe?g|gif|css|png|js|ico|pdf|zip|tar|t?gz|mp3|wav|swf)$" {
expires 30d;
log_not_found off;
}
#设置不被防问的目录
location ~ ^/(application|library|var)/ {
deny all;
}
#将request指向index.php
location / {
index index.php index.html index.htm;
if (-f $request_filename) {
break;
}
if (-d $request_filename) {
break;
}
rewrite ^(.+)$ /index.php last;
}
#引用PHP CGI
location ~ .*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 600;
}
}