Codeigniter URL仅适用于默认路由器

我已经在这个configuration上在Nginx上安装了Codeigniter:

server { listen 80; server_name myserver; root /usr/share/nginx/html; index index.php index.html index.htm; error_log /var/log/nginx/localhost.error_log debug; location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ { expires max; log_not_found off; } location / { try_files $uri $uri/ /index.php?/$request_uri; location = /index.php { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name; include fastcgi_params; } } location ~ /\.ht { deny all; } } 

我也用这种方式改变了ceodeignigter的configuration:

 ... $config['index_page'] = ''; $config['uri_protocol'] = 'REQUEST_URI'; ... 

这是我的默认控制器:

 <?php class Index extends CI_Controller { public function __construct(){ parent::__construct(); } public function index(){ $this->load->view('index'); } } 

我可以访问我的默认控制器,我已经定义了router.php文件,但我不能访问其他控制器呢。 任何帮助将不胜感激。

我用

 location / { try_files $uri $uri/ /index.php; } 

它的工作。 你也可以添加

 try_files /index.php$request_uri; 

最后。 没有 在CI中的index.php之后。