lnmp配置pathinfo模式

LNMP 配置支持 pathinfo

此文章来自 乌龟运维 wuguiyunwei.com

1,nginx里添加以下配置文件内容如下

set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "(.+?\.php)(/.*)") { set $real_script_name $1; set $path_info $2; } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info;

2 ,修改站点配置文件 内容如下

3, 修改 php.ini文件

最后重新 启动 Nginx和php 完成

时间: 2024-08-07 23:07:24

lnmp配置pathinfo模式的相关文章

Yii2.0配置pathinfo模式

原始访问模式为:http://www.month9bk.com/index.php?r=user/lists 那么想要改成全是/的pathinfo模式我们需要进行以下配置: 1.打开config文件夹下的main.php输入以下代码: 'urlManager' => [ //设置pathinfo模式 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ ], ], 此代码的位置为: 2.省略掉index

nginx中配置pathinfo模式示例

要想让nginx支持PATH_INFO,首先需要知道什么是pathinfo,为什么要用pathinfo? pathinfo不是nginx的功能,pathinfo是php的功能. php中有两个pathinfo,一个是环境变量$_SERVER['PATH_INFO']:另一个是pathinfo函数,pathinfo() 函数以数组的形式返回文件路径的信息;. nginx能做的只是对$_SERVER['PATH_INFO]值的设置. 下面我们举例说明比较直观.先说php中两种pathinfo的作用,

CentOS7 nginx简单配置pathinfo模式(ThinkPHP)

location ~ \.php {    #去掉$ root          H:/PHPServer/WWW; fastcgi_pass   127.0.0.1:9000; fastcgi_index  index.php; fastcgi_split_path_info ^(.+\.php)(.*)$;     #增加这一句 fastcgi_param PATH_INFO $fastcgi_path_info;    #增加这一句 fastcgi_param  SCRIPT_FILENA

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

ThinkPHP怎样配置URL模式为PathInfo?

1.修改thinkphp配置文件   打开文件,项目根目录/App/Home/Conf/config.php 'URL_MODEL'=>1, //url设置为PathInfo模式 2.修改linux下的nginx配置文件   /etc/nginx/nginx.conf server{ ...... location ~ \.php { root /www/; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param S

nginx完美支持thinkphp3.2.2(需配置URL_MODEL=>1 pathinfo模式)

来源:http://www.thinkphp.cn/topic/26657.html 第一步:配置SERVER块 server { listen 80; server_name www.domain.com domain.com; error_page 404 /404.html; error_page 500 502 503 504 /50x.html; # \.php 只处理动态请求,对于静态资源请求由下面的 location匹配和处理 location ~ \.php { root /da

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 fa