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 ...
随机推荐
- S2-033、S2-037
前言 S2-033漏洞和S2-032类似,也是由于开启了动态方法调用,action mapper中的执行的方法名可控,导致了ognl表达式注入. 正文 Rest插件中获取action mapper是用 ...
- laravel中引入composer安装在vendor中的第三方组件
一.安装第三方组件 方法一:使用命令行安装第三方(已phpword为例): composer require phpoffce/phpword ^v0..* 方法二: 修改主项目composer.js ...
- Marketing Cloud的contact merge机制
Marketing Cloud的contact支持多种多样的数据源,如下图所示: SAP Hybris Commerce SAP ERP SAP Cloud for Customer SAP Gigy ...
- MyBatis工厂工具类 MyBatisUtils
import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apach ...
- 【Hibernate】持久化对象状态及以及缓存
一.持久化类状态 1.1 三种持久化对象的状态 1.2 区分三种状态 1.3 三种状态对象转换 1.瞬时态 2.持久态 3.脱管态 4.持久态对象有自动更新数据库的能力 一.持久化类状态 1.1 三种 ...
- 【appium】appium中的元素定位和基本操作
# coding=utf-8 from appium import webdriver import time from selenium.webdriver.support.ui import We ...
- Windows服务 + Quartz.NET
服务基础 安装管理员打开cmd cd C:\Windows\Microsoft.NET\Framework\v4.0.30319 InstallUtil.exe Path_WinSvc.exe 或者 ...
- fastadmin 中 a标签跳转
<a class="btn-addtabs" href="/入口文件/模块/控制器"></a>
- Win10建立标准账户并设置标准账户权限
Win10建立标准账户,并使用组策略对标准帐户的权限进行管理. 注意:本文内容均在管理员帐户下操作,可以只看图片按图示步骤操作即可. 一.建立一个标准账户用于公用登录 (1)按”win健+R”运行“c ...
- python-----多线程笔记
多进程笔记: 多线程介绍: 多线程是为了同步完成多项任务,通过提高资源使用效率来提高系统的效率.线程是在同一时间需要完成多项任务的时候实现的. 最简单的比喻多线程就像火车的每一节车厢,而进程则是火车. ...