使nginx支持pathinfo模式】的更多相关文章

在将fastadmin部署到虚拟机中时,遇到如下问题:当访问登录页面时,页面进行不断的循环跳转重定向.解决方法是将nginx配置为支持pathinfo的模式 以下是nginx中的配置内容: location ~ \.php { #这里去掉了后面的$         root           /var/www/html/server/public;         fastcgi_pass   127.0.0.1:9000;         fastcgi_index  index.php;…
很久不使用apache了,渐渐对apache感到陌生,因为朋友有个ZendFramework框架从apache移到nginx下,需要pathinfo模式支持.网上海搜于是开始搜索nginx+pathinfo相关文章,一开以为很容易就会配置好.因为搜索后发现有大量文章介绍nginx开启pathinfo模式,感觉不是什么难事.但是经过几个小时下来,还是没有配置好.并且大量文章的内容都极其相似,基本都是转载的.开始有点急了!因为一天过去了没有配好.继续摸索没办法,继续搜索.为了验证方便,我用a.com…
Nginx服务器默认不支持pathinfo, 在需要pathinfo支持的程序中(如thinkphp),则无法支持”/index.php/Home/Index/index”这种网址.网上流传的解决办法很多,这里提供一种比较简洁的写法(只需要改动2行代码)典型配置location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $DOC…
将一个thinkphp项目从apache环境移到nginx1.2上,怎奈,nginx这个版本默认不支持pathinfo模式 首先,编辑nginx的虚拟主机配置文件 location ~ .*.(php|php5)?$ { #原有代码 } if (!-e $request_filename) {   rewrite  ^(.*)$  /index.php?s=$1  last;   break;    } #去掉$是为了不匹配行末,即可以匹配.php/,以实现pathinfo #如果你不需要用到p…
原理:     任意创建一个 in.php 文件:             <?php                       echo '<pre>';                       var_dump($_SERVER);                ?>      localhost/in.php/a/b/c    apache 用此 url 访问,会打印 pathinfo 模式信息.而 nginx 默认访问是没有的.所以 tp 框架在 nginx 上运行时…
简介:我们用thinkphp,CodeIgniter框架的时候,地址基本都是IP/index.php/group_controller?***的模式,通过index.php入口访问php文件 这种模式是path_info模式,pathinfo 模式是index.ph/index/index 这种url格式,nginx默认是不支持的,我们需要配置下 文件位置:/etc/nginx/nginx.conf 原文地址:http://blog.csdn.net/tinico/article/details…
Nginx服务器默认不支持pathinfo, 在需要pathinfo支持的程序中(如thinkphp),则无法支持”/index.php/Home/Index/index”这种网址. 网上流传的解决办法很多,这里提供一种比较简洁的写法(只需要改动2行代码) # 典型配置 location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME…
How To Set Nginx Support PATHINFO URL Model And Hide The /index.php/ 就像这样 The URL before setting like this: http://serverName/index.php?m=Home&c=Customer&a=getInformation&id=1 Now like this: http://serverName/Home/Customer/getInformation/id/1…
server { listen 80; server_name www.demo.com mayifanx.com; root /data/www/demo; index index.php index.html index.htm; #红色部分支持rewrite location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; } } location ~ \.php { fastcgi_pass 127…
# 典型配置 location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name; include fastcgi_params; } # 修改第1,6行,支持pathinfo location ~ \.php(.*)$ { # 正则匹配.php后的pathinfo部…
首先说下项目目录情况  跟目录/usr/share/nginx/html/(别说怎么这么深  0.0) html文件夹下面两个目录 pssh  pssh_shop 两个tp5项目分别对应两个二级域名 配置多项目就把server{} 在复制出来一套 修改对应的root路径就可以 下面放上配置文件(只有域名2那个项目隐藏入口文件了 ) # For more information on configuration, see: # * Official English Documentation: h…
只需要修改3个地方就可以了 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 …
创建服务器私钥,命令会让你输入一个口令: $ openssl genrsa -des3 -out server.key 1024 创建签名请求的证书(CSR): $ openssl req -new -key server.key -out server.csr 在加载SSL支持的Nginx并使用上述私钥时除去必须的口令: $ cp server.key server.key.org $ openssl rsa -in server.key.org -out server.key 最后标记证书使…
首先,需要修改/etc/sysctl.conf来更改内核参数.例如,最常用的配置: fs.file-max = 999999 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_keepalive_time = 600 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_max_tw_buckets = 5000 net.ipv4.ip_local_port_range = 1024 61000 net.ipv4.tcp_rmem =…
创建服务器私钥,命令会让你输入一个口令:$ openssl genrsa -des3 -out server.key 1024创建签名请求的证书(CSR):$ openssl req -new -key server.key -out server.csr在加载SSL支持的Nginx并使用上述私钥时除去必须的口令:$ cp server.key server.key.org$ openssl rsa -in server.key.org -out server.key最后标记证书使用上述私钥和C…
vi nginx/conf/nginx.conf 1.修改正则 set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$"){ set $real_script_name $; set $path_info $; } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_para…
server { listen 81; server_name http://lanxing.cc gohosts.com; root "D:\WWW\lanxing\public"; location / { index index.html index.htm index.php; #autoindex on; # 专门针对tp的rewrite模式 if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; b…
certbot官网:https://certbot.eff.org/lets-encrypt/centosrhel7-nginx 一.安装步骤 1)安装certbot,执行  sudo yum install certbot python2-certbot-nginx 2)检查是否安装成功,执行  certbot --help [root@iz2zeb4argxs74khdclp2dz ~]# certbot --help Traceback (most recent call last): F…
location ~ \.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; set $path_info ""; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1;…
  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_FILENAME $document_root$fas…
修改配置文件,修改特点域名的配置文件 location ~ \.php { #去掉$ root H:/PHPServer/WWW; fastcgi_pass ; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; #增加这一句 fastcgi_param PATH_INFO $fastcgi_path_info; #增加这一句 fastcgi_param SCRIPT_FILENAME $document_root$…
server { root /webserver/www/api; listen ; server_name api.dnxia.com; location / { if (!-e $request_filename) { rewrite "^/(.*)$" /index.php last; } } location ~\.php{ root /webserver/www/api; index index.php; fastcgi_pass ; fastcgi_index index.…
这篇文章仅仅是操作,解释说明部分待更新. 1. 修改nginx的配置文件(我的配置文件在/etc/nginx/nginx.conf) [root@xxx ~]# find / -name nginx.conf [root@xxx ~]# vim /etc/nginx/nginx.conf nginx.conf配置文件的大致结构: ... http{ server{ ... #一个server结构可以对应一个域名 } include vhosts/*.conf; #增加这一句,以后所有新增的域名都…
#CIserver {        listen      80;        server_name www.ci.com;        index       index.php index.html index.htm;        root        "/servers/apps/CI";      location ~ \\.php{       fastcgi_pass 127.0.0.1:9000;           fastcgi_index index.…
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.X…
nginx模式默认是不支持pathinfo模式的,类似index.php/index形式的url会被提示找不到页面.下面的通过正则找出实际文件路径和pathinfo部分的方法,让nginx支持pathinfo. 本文基于安装lnmp一键安装包,添加虚拟主机情况下进行修改 如你要添加一个网站www.linuxeye.com支持pathinfo,配置文件nginx.conf不用任何改变(个人习惯),参考lnmp一键安装包 cat vhost/www.linuxeye.com.conf server…
用thinkphp做了一个网站,部署到ubuntu上的时候需要,服务器用的是nginx,本身不支持pathinfo模式,需要修改配置文件,使其能够用pathinfo. 我用的是虚拟主机的方式.之前配置了好久,总是出现各种各样的问题,最后实在不行,直接用rewrite模式,配置还比较简单.后来不知道改了什么,rewrite也不能用了,这回打算把 pathinfo 配出来, 所以查了各种资料,一点一点的改.终于改成了. 发现很多网上的东西,其实和自己用的经常会有一点差别,需要根据自己的东西进行修改才…
几乎所有的框架(ThinkPHP,Zend Framework,CI,Yii,laravel等)都会使用URL重写或者pathinfo模式,使URL看起来更美观,比如可以隐藏掉入口文件,并且有利于搜索引擎优化,其实让Nginx支持pathinfo或者重写也不难,首先在php.ini中设置cgi.fix_pathinfo=1 再就是添加配置文件(新版nginx) 内容如下: #pathinfo 支持开始 以上配置信息根据实际情况配置 fastcgi_split_path_info ^((?U).+…
要想让nginx支持PATH_INFO,首先需要知道什么是pathinfo,为什么要用pathinfo? pathinfo不是nginx的功能,pathinfo是php的功能. php中有两个pathinfo,一个是环境变量$_SERVER['PATH_INFO']:另一个是pathinfo函数,pathinfo() 函数以数组的形式返回文件路径的信息;. nginx能做的只是对$_SERVER['PATH_INFO]值的设置. 下面我们举例说明比较直观.先说php中两种pathinfo的作用,…
FROM : http://www.4wei.cn/archives/1001174 应集团要求,公司的服务器全收到集团机房统一管理了,失去了服务器的管理配置权限. 杯具就此开始. 首先要解决文件大小写的问题.哥在开发的时候,比较注意大小写.文件名.相对路径的问题,程序整体迁移没有遇到任何问题. 其次是WebServer不支持PathInfo的问题.集团的运维同事,在所有服务器上都跑着Linux+Nginx,导致Apache开发的PathInfo模式出现艰难的迁移问题. 由于Nginx+Path…