1server {
2 listen 80;
3 server_name <serverName>;
4 index index.html index.htm index.php;
5 root <file url>;
6
7 location / {
8
9 # =================================================
10 # == 打开目录浏览功能(autoindex) ==
11 # =================================================
12 autoindex on; # 自动列目录配置, [on|off]
13 # 默认为on,显示出文件的确切大小, 单位是bytes;
14 # 改为off后,显示出文件的大概大小, 单位是kB或者MB或者GB(B、KB、MB、GB)
15 autoindex_exact_size [on|off]
16 # 默认为off,显示的文件时间为GMT时间。
17 # 改为on后,显示的文件时间为文件的服务器时间
18 autoindex_localtime [on|off]
19
20
21
22 if ( $request_filename !~ (index\.php|static) ) {
23 rewrite ^/(.*)$ /index.php/$1 last;
24 }
25 }
26
27 location ~ .*\.(php|php5)?$ {
28 fastcgi_pass 127.0.0.1:9000;
29 fastcgi_index index.php;
30 include fastcgi_params;
31 fastcgi_param PATH_INFO $fastcgi_script_name;
32 fastcgi_param SCRIPT_FILENAME /var/www/ci$fastcgi_script_name;
33 }
34
35 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
36 expires 30d;
37 }
38
39 location ~ .*\.(js|css)?$ {
40 expires 1h;
41 }
42
43 location ~ /\.ht { # 防抓取
44 deny all;
45 }
46}