|
今天遇到一个问题。在ubuntu 13.4下,运行ci。无法正常运行。查找了一下原因是因为index.php原因。发了一下午时间。终于解决啦。将经验分享大家
- server
- {
- listen 80;
- server_name admin.cc;
- index index.html index.htm index.php default.html default.htm default.php;
- root /home/wwwroot/admin.cc;
- include other.conf;
- location / {
- index index.php;
- if (!-e $request_filename) {
- rewrite ^/(.*)$ /index.php?$1 last;
- break;
- }
- }
- location ~ .*\.(php|php5)?$
- {
- try_files $uri =404;
- fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_index index.php;
- include fcgi.conf;
- }
- location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- {
- expires 30d;
- }
- location ~ .*\.(js|css)?$
- {
- expires 12h;
- }
- access_log /home/wwwlogs/admin.cc.log admin.cc;
- }
复制代码
主要是这段代码:
- location / { # 注意这里写 “/" 如果有子目录则是 /forlde/ 即可
- index index.php;
- if (!-e $request_filename) {
- rewrite ^/(.*)$ /index.php?$1 last; # 关键代码
- break; # 必须加break 跳出
- }
- }
复制代码
|
|