我曾经针对yii制作了 个nginx配置,其中包括了以下几项内容:
在这里分享一下demo
server { listen 80; server_name youdomain.com; index index.html index.htm index.php; root /home/wwwroot/htdocs/yii-1.1.8.r3324/demos/blog; #charset koi8-r; # 这里的main,是nginx默认的httpd段的一个日志格式定义 access_log /home/wwwlogs/localhost.access.log main; #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # #error_page 500 502 503 504 /50x.html; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } ################ Yii framework rule ################# location / { try_files $uri $uri/ /index.php?$args; } location ~ /(protected|framework|nbproject|themes/\w+/views|index-test\.php) { deny all; # for production internal; log_not_found off; access_log off; } ################ for Yii framework end ################# location ~ \.php$ { fastcgi_pass php; fastcgi_index index.php; include fastcgi.conf; } # deny access to .htaccess files, if Apache‘s document root # concurs with nginx‘s one # location ~ /(\.svn|\.git|\.ht|\.DS) { deny all; internal; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } }
针对Yii框架的nginx配置,布布扣,bubuko.com
原文:http://www.cnblogs.com/CF3B5/p/3747730.html