首先tp5的访问目录指向到webroot/public文件夹中。
thinkphp的url访问:http://serverName/index.php(或者其它应用入口文件)/模块/控制器/操作/[参数名/参数值...],这个需要支持pathinfo,Apache默认支持,而Nginx不支持。
1.php.ini中的配置参数cgi.fix_pathinfo = 1
2.修改nginx.conf文件。

  1. location ~ \.php(.*)$ {
  2. fastcgi_pass   127.0.0.1:9000;
  3. fastcgi_index  index.php;
  4. #下面两句是给fastcgi权限,可以支持 ?s=/module/controller/action的url访问模式
  5. fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
  6.             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  7. #下面两句才能真正支持 index.php/index/index/index的pathinfo模式
  8. fastcgi_param  PATH_INFO  $fastcgi_path_info;
  9.             fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
  10. include        fastcgi_params;
  11. }
复制代码

这样就能在linux,nginx环境下运行tp5了。

3. 去掉/index.php/
修改nginx.conf文件

    1. location / {
    2. index  index.html index.htm index.php;
    3. #autoindex  on;
    4. if (!-e $request_filename) {
    5. rewrite  ^(.*)$  /index.php?s=/$1  last;
    6. break;
    7. }
    8. }

nginx - nginx下配置thinkphp5的更多相关文章

  1. nginx环境下配置nagios-关于nagios配置文件nginx.conf

    接上文:nginx环境下配置nagios-关于nginx.conf 配置如下: ;          location ~ .*\.(php|php5)?$          {            ...

  2. nginx环境下配置nagiosQL-关于nagiosql配置文件

    接上文:nginx环境下配置nagios-关于nginx.conf nagiosql文件应该处于conf/domain/目录下 nagiosql配置如下: ;                  gzi ...

  3. Nginx环境下配置PHP使用的SSL认证(https)

    最近一段时间发现好多网站都从http协议变成了加密的https协议,比如说百度.吾志等等.https看起来比http高端了好多,而且在不同的浏览器向上还会显示出不同于http的URL展示效果(比如说c ...

  4. <nginx+PHP>nginx环境下配置支持php7

    [root@redhat7 ~]# wget http://am1.php.net/get/php-7.1.2.tar.gz/from/this/mirror [root@redhat7 ~]# ta ...

  5. nginx环境下配置nagios-关于start_perl_cgi.sh

    >/dev/ rm $dir/logs/perl-fcgi.sock >/dev/ echo  }    start ()  {  rm $dir/now_start_perl_fcgi. ...

  6. nginx环境下配置nagios-关于perl-fcgi.pl

    配置文件如下: 请注意,网上提供的官方文档在运行时可能会出现问题,此文中保证无问题. ; ; ; ;  ); ;  ); ; ;          my $pidnumber = $$;        ...

  7. phpmyadmin在nginx环境下配置错误

    location ~ \.css {           add_header  Content-Type    text/css;        } location ~ \.js {        ...

  8. 在phpstudy集成环境下的nginx服务器下配置url重写

    直接在对应的vhosts.conf配置文件的location / {}中添加以下内容: location / { index index.html index.htm index.php; #auto ...

  9. nginx环境下配置nagios-关于commands.cfg

    -w $ARG1$ -c $ARG2$ -M -b% -c % -f% -c % -f% -c % -f #  define command{         command_name    chec ...

随机推荐

  1. springload热更新的优缺点

    java开发web应用没有.net的方便快捷, 原因是传统开发模式下新增修改代码后要查看效果, 一般要重启应用, 导致浪费了许多无谓的时间,没有.net的高效, 任意更新文件实时生效. 但是有个叫sp ...

  2. 使用SQLAlchemy,以及问题处理

    https://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/0014021031294178 ...

  3. 【leetcode】302.Smallest Rectangle Enclosing Black Pixels

    原题 An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The bl ...

  4. Computer Vision_33_SIFT:Remote Sensing Image Registration With Modified SIFT and Enhanced Feature Matching——2017

    此部分是计算机视觉部分,主要侧重在底层特征提取,视频分析,跟踪,目标检测和识别方面等方面.对于自己不太熟悉的领域比如摄像机标定和立体视觉,仅仅列出上google上引用次数比较多的文献.有一些刚刚出版的 ...

  5. 初级文件IO——IO过程、open、close、write、read、lseek、dup、dup2、errno、perror

    先要回答的问题 文件IO指的是什么? 本文主要讲述如何调用Linux OS所提供的相关的OS API,实现文件的读写. 如何理解文件IO? IO就是input output的意思,文件io就是文件输入 ...

  6. Selenium(六)对话框处理与登录测试

    1.以百度为例,找到登录框,查看元素,可以看到这是一个div 操作登录框: 通过判断是否找到这个错误提示元素查看是否登录成功. 一个简单的登录脚本:

  7. JAVA遇见HTML——JSP篇(JSP内置对象上)

    action:表单交给哪个动作去处理 MIME类型: 浏览器通常使用MIME类型(而不是文件扩展名)来确定如何处理文档:因此服务器设置正确以将正确的MIME类型附加到响应对象的头部是非常重要的. 语法 ...

  8. investigate issues of real time interrupted

    Issues: customer report that real time will interrupted frequently as below: Root Cause: some storm ...

  9. mysql对两个字段进行自定义排序

    Mysql order by 多字段排序 ') desc,ADD_DATE desc mysql单个字段降序排序: select * from table order by id desc; mysq ...

  10. Cannot modify resource set without a write transaction 问题

    TransactionalEditingDomainImpl editingDomain = (TransactionalEditingDomainImpl) diagramEditor.getEdi ...