了解知识
有些朋友是否会问,为什么要配置CI框架呢,不能直接访问吗,关于这一点,我讲解一下。用CI框架所做的项目,一般都是php文件,访问的地址类似:http://www.internetwork.net/index/home 等,所以说我们要在配置里面修改,让他能够解析成我们需要的,今天我给大家一个例子:
 
  1. server 
  2.     { 
  3.         listen       80; 
  4.         server_name www.internetwork.ne; 
  5.         index index.html index.htm index.php; 
  6.         root  /home/wwwroot/internetwork; 
  7.  
  8.         try_files $uri $uri/ /index.php?$uri&$args
  9.             location / { 
  10.                      if (-e $request_filename) { 
  11.                                 break
  12.                         } 
  13.                        if (!-e $request_filename) { 
  14.                                 rewrite ^/(.*)$ /index.php/$1 last; 
  15.                         } 
  16.  
  17.         } 
  18.  
  19.         location ~ ^(.+\.php)(.*)$ { 
  20.             include fastcgi_params; 
  21.             root /home/wwwroot/internetwork; 
  22.             fastcgi_pass unix:/tmp/php-cgi.sock; 
  23.             #fastcgi_pass 127.0.0.1:9000; 
  24.             fastcgi_index index.php; 
  25.             fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; 
  26.             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name
  27.             fastcgi_param PATH_INFO $fastcgi_path_info
  28.             fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info
  29.  
  30.         } 
  31.  
  32.         location /status { 
  33.             stub_status on; 
  34.             access_log   off; 
  35.         } 
  36.  
  37.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ 
  38.             { 
  39.                 expires      30d; 
  40.             } 
  41.  
  42.         location ~ .*\.(js|css)?$ 
  43.             { 
  44.                 expires      12h; 
  45.             } 
  46.  
  47.         access_log  /home/wwwlogs/access.log  access; 
  48.     } 
  49. include vhost/*.conf; 
标签: CI框架 nginx
扩展知识