lnmp1.2 开启pathinfo模式

默认的lnmp没有开启pathinfo模式,但很多框架需要用到。

cd /usr/local/nginx/conf

vim enable-php.conf

location ~ [^/]\.php(/|$)
{
  # comment try_files $uri =404; to enable pathinfo
  #try_files $uri =404;
  fastcgi_pass unix:/tmp/php-cgi.sock;
  fastcgi_index index.php;
  include fastcgi.conf;
  include pathinfo.conf;#新增pathinfo模式
}

service nginx restart

OK

时间: 2024-08-07 04:06:08

lnmp1.2 开启pathinfo模式的相关文章

php开启pathinfo 模式

pathinfo 模式 需要 php.ini 开启下面这个参数 cgi.fix_pathinfo=1 path_info模式:http://www.xxx.com/index.php/模块/方法 而且nginx 环境下,如果 uri 含中文,PATH_INFO就被截断了,会新产生一个 ORIG_PATH_INFO,才是正确的, 原文地址:https://www.cnblogs.com/xiaoleiel/p/8324249.html

nginx下开启pathinfo模式

第一种方式是通过重写url来实现pathinfo模式: 1 location / { 2 if (!-e $request_filename){ 3 rewrite ^/(.*)$ /index.php?s=/$1 last; 4 } 5 } 第二种方式 ,改变 \.php的 1 location ~ \.php { 2 #fastcgi_pass 127.0.0.1:9000; 3 #fastcgi_pass unix:/dev/shm/php-cgi.sock; 4 fastcgi_pass

lnmp1.0支持pathinfo模式

首先,在ssh中执行 touch /usr/local/nginx/conf/pathinfo.conf 创建pahtinfo.conf文件 然后在这个文件中添加以下内容 set $real_script_name $fastcgi_script_name;if ($fastcgi_script_name ~ "(.+?\.php)(/.*)") {set $real_script_name $1;set $path_info $2;}fastcgi_param SCRIPT_FILE

Nginx下配置ThinkPHP的URL Rewrite模式和pathinfo模式支持

前面有关于lnmp环境的搭建,在此就不在赘述.下面就简述thinkPHP如何在nginx下开启url_rewrite和pathinfo模式支持 主要有两个步骤: 一.更改php.ini将;cgi.fix_pathinfo=0  改为cgi.fix_pathinfo=1 二.更改nginx配置文件中php的location设置pathinfo模式: location ~ \.php { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index in

LNMP一键安装包+Thinkphp搭建基于pathinfo模式的路由(可以去除url中的.php)

LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RadHat/Fedora.Debian/Ubuntu/Raspbian/Deepin VPS或独立主机安装LNMP(Nginx/MySQL/PHP).LNMPA(Nginx/MySQL/PHP/Apache).LAMP(Apache/MySQL/PHP)生产环境的Shell程序.同时提供一些实用的辅助工具如:虚拟主机管理.FTP用户管理.Nginx.MySQL/MariaDB.PHP的升级.常用缓存组件Redis.Xca

lnmp 环境搭建后,pathinfo 模式支持的配制。

ThinkPHP的四种URL模式:0(普通模式);1(PATHINFO模式);2(REWRITE模式);3(兼容模式) nginx需要PATHINFO模式,但需要更改nginx配置文件让其支持PATHINFO模式. 系统环境: 系统:CentOS-6.4-x86_64 web服务器:nginx1.2.7 PHP版本:PHP5.3.17 数据库版本:MySQL5.5.28 一.安装LNMP1.0一键安装包: http://lnmp.org/install.html 按照以上版本安装环境 1.修改p

[PHP] url的pathinfo模式加载不同控制器的实现

使用自动加载和解析url的参数,实现调用到不同的控制器,实现了pathinfo模式和普通的url模式 文件结构: |--Controller |--Index |--Index.php |--Application.php Application.php <?php class Application{ public static function main(){ header("content-type:text/html;charset=utf-8"); self::regi

【FE前端学习】sublime开启vim模式

学习目标:在sublime下开启vim模式,了解基本vim的编辑快捷键. 下载安装Sublime Text 3 :http://www.sublimetext.com/3 Vim/Vi: Vim/Vi 是一个文本编辑器,没有菜单,只有命令,适合写前端代码.高效命令行使用vim编辑文本,只需在键盘上操作就可以,根本无需用到鼠标.. 开启vim模式: 在菜单栏中: Preferences -> Setting - User 即可打开配置文件进行编辑,将 ignored_packages 项的[]里面

制作类似ThinkPHP框架中的PATHINFO模式功能(二)

距离上一次发布的<制作类似ThinkPHP框架中的PATHINFO模式功能>(文章地址:http://www.cnblogs.com/phpstudy2015-6/p/6242700.html)已经过去好多天了,今晚就将剩下的一些东西扫尾吧. 上一篇文章已经实现了PATHINFO模式的URL,即我们访问MVC模式搭建的站点时,只需要在域名后面加上(/module/controller/action)即可,很智能化.并且通过new Object时的自动触发函数实现类文件的自动载入,因此只要我们搭