zoukankan      html  css  js  c++  java
  • ubuntu thinkphp pathinfo 404等问题

    这个问题 困扰了我一天,由于对nginx的配置文件中的各种变量不懂。配置起来很麻烦,从网上搜索的,感觉合适自己的不多!!!

    找啊找啊。。终于找一篇!!!!

    我的环境:
    
    php 5.3.10
    
    ubuntu 12.04 LTS
    
    nginx   1.2.9

    http://www.nginx.cn/426.html         这一篇,我找到了适合自己的部分。这种代码好像不能完全套用。。。。

    1 首先编辑 php.ini

    例如我的是:

    sudo vim /etc/php5/fpm/php.ini

    找到cgi.fix_pathinfo ,把前面的  ;  号去掉,值设为0

    #按照下面这样设置
    cgi.fix_pathinfo = 0

    2  修改nginx的配置文件   ---  nginx.conf 

    #根目录配置部分 --------- 

    location / {
       root /usr/local/nginx/html;

       index index.php index.html index.htm;
    }


    # php的配置部分
    location ~ ^.+.php {   fastcgi_pass unix:/dev/shm/php.socket;   fastcgi_index index.php;   fastcgi_split_path_info ^(.+.php)(.*)$;   fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;   fastcgi_param PATH_INFO $fastcgi_path_info;   include fastcgi_params;   } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /.ht { deny all; }

    3   修改thinkPHP项目中的conf

    sudo vim /usr/local/nginx/html/test/project1/Conf/config.php

    // pathinfo 模式设置成 1
    'URL_MODEL' => 1,
    
    

    好了,经过上面这些配置,在浏览器打开一个空白页,输出地址,看看正确否~~~~

    希望这段分享能帮助你!!!

    PHP程序员 人在北京 如有需要,可以站内联系我!!!
  • 相关阅读:
    Eclipse安装常用离线插件
    Eclipse添加Maven、Jdk、Tomcat
    每天总结模电-去耦电容(一)
    4K显示器含义
    c语言的学习方法
    悲伤逆流成河读后感
    晶体管(三极管,场效应管,MOS以及CMOS)的区别
    强电的元器件认识
    ElasticSearch
    DataGrip
  • 原文地址:https://www.cnblogs.com/flex_fly/p/3173580.html
Copyright © 2011-2022 走看看