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 ...
 
随机推荐
- Windows10+Android Studio 3.5编译项目报错——NDK Resolution Outcome: Project settings: Gradle model version=4.10.1, NDK version is UNKNOWN
			
项目背景: 系统有C.D两个盘,Android Studio安装在D盘,sdk安装在C盘. 出现的问题: 从git拉取项目后,一直编译不通过,提示“NDK Resolution Outcome: Pr ...
 - 面试总结关于Spring面试问题(精选)
			
1.什么是Spring? Spring是一个反转控制IOC和AOP的开发框架和平台. 2.解释一下Spring? 轻量 : Spring 在大小和透明度上是轻量的,Spring基本核心版本大概只有1M ...
 - SpringCloud各个组件通俗解析
			
https://www.cnblogs.com/lonelyJay/p/9936241.html
 - 常用git指令记录
			
Generating an SSH key Checking for existing SSH keys Generating a new SSH key and adding it to the s ...
 - Django hrf:权限、频率控制
			
一.权限 二.频率控制 一.权限 1.权限介绍 只有超级用户才能访问指定的数据,所以就要用权限组件进行设置 2.局部使用 # 单独抽出写一个视图类 from rest_framework.permis ...
 - C#当中的BeginInvoke和EndInvoke
			
我们已经知道 C#当中 存在async/await .BackGroudWorker类以及TPL(任务并行库).当然C#还有一些旧的模式来支持异步编程.参考<C#图解教程> 1. Beg ...
 - 使用fastjson统一序列化响应格式
			
摘要:其实很简单的处理方式,只不够优雅,或者说没有找到fastjson为其提供便捷的处理方式.因此记录下处理该问题的过程. 目标:将所有api请求,即响应为APPLICATION_JSON的内容做统一 ...
 - nagios安装部署及详细配置说明(转)
			
一.Nagios简介 Nagios是一款开源的电脑系统和网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报 ...
 - mysql运维相关
			
1.为什么要分库分表(设计高并发系统的时候,数据库层面该如何设计)?用过哪些分库分表中间件?不同的分库分表中间件都有什么优点和缺点?2.现在有一个未分库分表的系统,未来要分库分表,如何设计才可以让系统 ...
 - Netty搭建服务端的简单应用
			
Netty简介 Netty是由JBOSS提供的一个java开源框架,现为 Github上的独立项目.Netty提供异步的.事件驱动的网络应用程序框架和工具,用以快速开发高性能.高可靠性的网络服务器和客 ...