首页 > 代码库 > CodeIgniter框架——nginx下的配置

CodeIgniter框架——nginx下的配置

odeigniter(CI)是一个轻量型的PHP优秀框架,但是它是在apache服务器下开发的,在nginx下需要特别的配置才可以使用。

对nginx的配置如下:

 

 1 server { 2     listen 80 default_server; 3     listen [::]:80 default_server ipv6only=on; 4  5     root /home/mqx/openflow/openflow/openflow/web; 6     index index.html index.htm index.php; 7  8     server_name localhost; 9 10     location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {11         expires max;12         log_not_found off;13     }14 15 16     location / {17         try_files $uri $uri/ /index.php;18         #try_files $uri $uri/ =404;19     }20 21     error_page 500 502 503 504 /50x.html;22     location = /50x.html {23         root /usr/share/nginx/html;24     }25 26     location ~ \.php$27     {28 29       fastcgi_pass 127.0.0.1:9000;30         fastcgi_index index.php;31         fastcgi_param   PATH_INFO      $fastcgi_path_info;32         fastcgi_param    SCRIPT_FILENAME    /home/mqx/openflow/openflow/openflow/web$fastcgi_script_name;33         fastcgi_param    PATH_TRANSLATED    /home/mqx/openflow/openflow/openflow/web$fastcgi_path_info;34         include fastcgi_params;35     }36 37     location ~ /\.ht {38         deny all;39     }40 }

 

几个不错的配置博文:

codeigniter在nginx安装配置及URL重写

nginx配置CI框架的完整版

nginx下codeigniter框架的rewrite规则