nginx - nginx下配置thinkphp5
首先tp5的访问目录指向到webroot/public文件夹中。
thinkphp的url访问:http://serverName/index.php(或者其它应用入口文件)/模块/控制器/操作/[参数名/参数值...],这个需要支持pathinfo,Apache默认支持,而Nginx不支持。
1.php.ini中的配置参数cgi.fix_pathinfo = 1
2.修改nginx.conf文件。
- location ~ \.php(.*)$ {
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- #下面两句是给fastcgi权限,可以支持 ?s=/module/controller/action的url访问模式
- fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- #下面两句才能真正支持 index.php/index/index/index的pathinfo模式
- fastcgi_param PATH_INFO $fastcgi_path_info;
- fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
- include fastcgi_params;
- }
这样就能在linux,nginx环境下运行tp5了。
3. 去掉/index.php/
修改nginx.conf文件
- location / {
- index index.html index.htm index.php;
- #autoindex on;
- if (!-e $request_filename) {
- rewrite ^(.*)$ /index.php?s=/$1 last;
- break;
- }
- }
nginx - nginx下配置thinkphp5的更多相关文章
- nginx环境下配置nagios-关于nagios配置文件nginx.conf
接上文:nginx环境下配置nagios-关于nginx.conf 配置如下: ; location ~ .*\.(php|php5)?$ { ...
- nginx环境下配置nagiosQL-关于nagiosql配置文件
接上文:nginx环境下配置nagios-关于nginx.conf nagiosql文件应该处于conf/domain/目录下 nagiosql配置如下: ; gzi ...
- Nginx环境下配置PHP使用的SSL认证(https)
最近一段时间发现好多网站都从http协议变成了加密的https协议,比如说百度.吾志等等.https看起来比http高端了好多,而且在不同的浏览器向上还会显示出不同于http的URL展示效果(比如说c ...
- <nginx+PHP>nginx环境下配置支持php7
[root@redhat7 ~]# wget http://am1.php.net/get/php-7.1.2.tar.gz/from/this/mirror [root@redhat7 ~]# ta ...
- nginx环境下配置nagios-关于start_perl_cgi.sh
>/dev/ rm $dir/logs/perl-fcgi.sock >/dev/ echo } start () { rm $dir/now_start_perl_fcgi. ...
- nginx环境下配置nagios-关于perl-fcgi.pl
配置文件如下: 请注意,网上提供的官方文档在运行时可能会出现问题,此文中保证无问题. ; ; ; ; ); ; ); ; ; my $pidnumber = $$; ...
- phpmyadmin在nginx环境下配置错误
location ~ \.css { add_header Content-Type text/css; } location ~ \.js { ...
- 在phpstudy集成环境下的nginx服务器下配置url重写
直接在对应的vhosts.conf配置文件的location / {}中添加以下内容: location / { index index.html index.htm index.php; #auto ...
- nginx环境下配置nagios-关于commands.cfg
-w $ARG1$ -c $ARG2$ -M -b% -c % -f% -c % -f% -c % -f # define command{ command_name chec ...
随机推荐
- LINUX学习笔记——LINUX下EXP命令全库备份数据库文件
LINUX下EXP命令全库备份数据库文件 1)建立备份目录,目录操作权限授权给Oracle用户 mkdir /backup --创建backup文件夹 cd / --进入cd语句 ls -l ...
- 理解JVM之垃圾回收
1.垃圾收集算法 1) 标记-清楚算法:该算法是最基础的收集算法,其分为标记与清除两个阶段.首先标记出所有需要回收的对象,在标记完成后统一回收所有被标记的对象,该算法主要有两个不足:一个是效率问题,标 ...
- js 定时器(setTimeout/setInterval)出现变量未定义(xxx is not defined) 的解决方法
首先声明本人资质尚浅,如有错误,欢迎指正.共同提高. ------------------------------------------------------------------------- ...
- java入门学习总结_04
1.循环结构 2.方法 循环结构 概述 1.对于某些需要重复执行的,相同或者相似的语句,使用某种格式来完成对代码的简化. 2.实现的语句: for语句[常用] while语句[常用] do...whi ...
- Image Processing and Analysis_8_Edge Detection:Design of steerable filters for feature detection using canny-like criteria ——2004
此主要讨论图像处理与分析.虽然计算机视觉部分的有些内容比如特 征提取等也可以归结到图像分析中来,但鉴于它们与计算机视觉的紧密联系,以 及它们的出处,没有把它们纳入到图像处理与分析中来.同样,这里面也有 ...
- C#的预处理指令
- c# 选择结构
- Free lunch is over
译文:http://www.mamicode.com/info-detail-1324737.html 原文:http://www.gotw.ca/publications/concurrency-d ...
- 《构建之法》——Alpha2项目的测试
这个作业属于哪个课程 课程的链接 这个作业要求在哪里 作业要求的链接 团队名称 Runningman 这个作业的目标 测试其他组的项目,互相借鉴 作业正文 作业正文 测试人姓名 陈嘉莹 测试人学号 2 ...
- less避免编译
less里面有一个避免编译,有时候我们需要输出一些不正确的css语法或者使用less不认识的专有语法.要输出这样的值我们可以在字符串前加上一个~ /*避免编译*/ .test_03{ width: 3 ...