tolowwer 发表于 2014-11-22 12:39:42

新安装了codeigniter如何配置nginx和路由

求一个可用的配置,目前搜索到一些,试了一下都不行,目前的配置是:
server {
    listen       80;
    server_namewww.test.com;
    location / {
      root   E:/svn/osweb;
      indexindex.html index.htm index.php default.php;
               
    }
    error_page   500 502 503 504/50x.html;
    location = /50x.html {
      root   html;
    }
    location ~ .*\.php?$ {
      root         E:/svn/osweb;
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_paramSCRIPT_FILENAMEE:/svn/osweb$fastcgi_script_name;
      include      fastcgi_params;
    }
       
}

----曾增加过rewrite规则---
if (!-e $request_filename) {
                        rewrite ^(.*)$ /index.php?s=$1 last;
                        break;
                }   


---也曾增加nginx支持path的---
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param   PATH_INFO $fastcgi_path_info;


-------------config
$config['base_url'] = 'http://www.test.com';
$config['index_page'] = 'index.php';
$config['uri_protocol']        = 'PATH_INFO';


--------router
$route['default_controller'] = 'welcome';
$route['login'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;


但是目前都是404,除了通过www.test.com能访问到默认页面之外,访问任何都是404,
如www.test.com/welcome
www.test.com/login

求解决谢谢,环境:
NPMserv 是一款界面化的快速搭建nginx0.7.63、PHP 5.2.11、MySQL 5.1.28、phpMyAdmin 3.2.1,网站服务器平台的绿色软件。
作者:NginxCN团队

tolowwer 发表于 2014-11-22 15:20:24

已解决,不再使用pathinfo,
直接配置为$config['uri_protocol']        = 'REQUEST_URI';
发现网上没几个真正理解php和nginx的运行原理

xl33550336 发表于 2017-12-19 11:31:45

求教一下,我是用lnmp1.2安装的环境,nginx不要改动,只改config文件吗?
页: [1]
查看完整版本: 新安装了codeigniter如何配置nginx和路由