征服天堂

Just do it!
文章标签 ‘nginx’

nginx默认情况下是不支持thinkphp的PATHINFO模式的
需要自行更改nginx的默认配置项,例如:
编辑/etc/nginx/sites-available/default

  1. server {
  2.  listen       80;
  3.  
  4.               server_name  www.xxx.com;
  5.  
  6.               index index.html index.htm index.php index.shtml;
  7.  
  8.               root /thinkphp/www/thinkphp;
  9.  
  10.  
  11.  
  12.               location / {
  13.  
  14.                    if (!-e $request_filename){
  15.  
  16.                         rewrite ^(.*)/index.php?s=/$1 last; #rewrite模式   
  17.  
  18.                         rewrite ^(.*)/index.php/$1 last; #pathinfo模式 任选其一   
  19. [……]阅读全文

在CodeIgniter框架下,http://localhost/index.php可以正常访问

但这样访问时http://localhost/index.php/welcome/页面报错500 Internal Server Error

查看nginx错误日志发现

open() “/usr/share/nginx/test/index.html” failed (2: No such file or directory)

居然访问的是index.html而不是index.php
[……]阅读全文