How to configure Nginx in CI framework

Source: Internet
Author: User

CodeIgniter (CI) is a lightweight PHP framework, because it was developed under the Apache server, so it needs special configuration to be used under Nginx.

Here's how:

1. application/config/config.php modify it to about 48 lines.

  $config [ ‘uri_protocol‘ ] =  "PATH_INFO" ;2. Configuring the Nginx.conf Fileserver {

Listen 80;

Listen [::]:80 Ipv6only=on;

server_name localhost;

#charset Koi8-r;

#access_log Logs/host.access.log Main;

Root share/nginx/html;

Index index.php index.html index.htm;

Location/{

#root share/nginx/html;

#index index.php index.html index.htm;

Try_files $uri $uri//index.php? $query _string;

}

Location ~ \.php ($|/) {

root localhost;//is similar to Apache's host address such as: share/nginx/html;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_split_path_info ^ (. +\.php) (. *) $;

Fastcgi_param path_info $fastcgi _path_info;

fastcgi_param script_filename localhost$fastcgi_script_name;//localhost here refers to the full root address for example: /opt/local/share/nginx/html

Include fastcgi.conf;

}

How to configure Nginx in CI framework

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.