Problems with CodeIgniter development-php Tutorial

Source: Internet
Author: User
Problems with CodeIgniter development CodeIgniter and nginx

When CodeIgniter and nginx are used together, these two error messages are often prompted:

File not found No input file specified

This error is related to path_info and requires simple configuration in the site configuration corresponding to nginx. Below I will post the configuration of one of my sites for your reference:

server {    listen      80;    server_name services.xx.com;    server_name_in_redirect  off;    root /data/web/xx/services;    index index.php index.htm index.html;    error_log  /data/log/xx/web_common/error.log ;    access_log /data/log/xx/web_common/access.log main;    location / {         index  index.php index.html;    }    if (!-e $request_filename) {        rewrite ^/(.*)$ /index.php/$1 last;        break;    }    location ~ .*\.(svn|git|cvs) {         deny all;    }    location ~* \.(htm|html|xml|shtml)$ {         expires 600;     }    location  ~* \.(js|css|htc|gif|ico|png|swf|jpg|jpeg|bmp)$ {          expires 365d;     }    location ~* \.(bak|tar|gz|zip|tgz|sql)$ {          return 403;     }    location ~ .*.php($|/) {         fastcgi_split_path_info ^(.+\.php)(.*)$;         fastcgi_param PATH_INFO $fastcgi_path_info;         include php_fastcgi_params;         fastcgi_pass  unix:/tmp/php-fpm.sock;         fastcgi_index index.php;   }   }

Pay special attention to fastcgi_split_path_info, fastcgi_param PATH_INFO, and location ~ in the last configuration ~ . *. Php ($ | /). Compare your configuration with my configuration.

For scenarios with sub-sites, for example, my CI directory structure is as follows:

---- application    |---- api    |---- wechat---- system---- logs……

The application directory is delegated to the sub-sites and accessed through the same second-level domain name. for example, if it is pai.xx.com, the access links of the sub-sites are:

http://apps.xx.com/apihttp://apps.xx.com/wechat

The second-level domain name corresponding to apps is:

server {    listen      80;    server_name apps.xx.com;    server_name_in_redirect  off;    root /data/web/xx/application;    index index.php index.htm index.html;    error_log  /data/log/xx/web_common/error.log ;    access_log /data/log/xx/web_common/access.log main;    location / {        index index.php index.html;    }    location /api {       index  index.php index.html;       if ( !-e $request_filename ) {           rewrite ^/api/(.+)$ /api/index.php/$1 last;           break;       }    }    location /wechat {       index  index.php index.html;       if ( !-e $request_filename ) {           rewrite ^/wechat/(.+)$ /wechat/index.php/$1 last;           break;       }    }    location ~ .*\.(svn|git|cvs) {         deny all;    }    location ~* \.(htm|html|xml|shtml)$ {        expires 600;     }    location  ~* \.(js|css|htc|gif|ico|png|swf|jpg|jpeg|bmp)$ {          expires 365d;     }    location ~* \.(bak|tar|gz|zip|tgz|sql)$ {         return 403;     }     location ~ .*.php($|/) {        fastcgi_split_path_info ^(.+\.php)(.*)$;        fastcgi_param PATH_INFO $fastcgi_path_info;        include php_fastcgi_params;        fastcgi_pass  unix:/tmp/php-fpm.sock;        fastcgi_index index.php;   }   }

Pay attention to the configuration of each sub-site.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.