nginx模式默认是不支持pathinfo模式的,类似index.php/index形式的url会被提示找不到页面。下面的通过正则找出实际文件路径和pathinfo部分的方法,让nginx支持pathinfo。

 server {listen       8080;server_name  ewifiportal.com;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root   D:/Users/xc/Zend/workspaces/DefaultWorkspace/EWiFiPortal;index  index.html index.htm index.php;}#error_page  404              /404.html;# redirect server error pages to the static page /50x.html#error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {#    proxy_pass   http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#location ~ \.php {root           D:/Users/xc/Zend/workspaces/DefaultWorkspace/EWiFiPortal;fastcgi_pass   127.0.0.1:9000;fastcgi_index  index.php;fastcgi_split_path_info ^(.+\.php)(.*)$;#fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_param   PATH_INFO $fastcgi_path_info;fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;fastcgi_param    PATH_TRANSLATED    $document_root$fastcgi_path_info;include        fastcgi_params;}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {#    deny  all;#}}

要点:
1.~ \.php 后面不能有$  以便能匹配所有 *.php/* 形式的url

2. 需要设置path_info

fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param   PATH_INFO $fastcgi_path_info;

转载于:https://www.cnblogs.com/vania/p/4974337.html

配置nginx,支持php的pathinfo路径模式相关推荐

  1. Nginx支持PHP的PATHINFO模式配置深入分析

    ThinkPHP5发布了,最近也要基于ThinkPHP5做一个小项目,借着这个机会彻底梳理下Nginx下有关pathinfo的配置.本文的宗旨是:远离咬文嚼字的理论,尽量的通俗.所以不可避免的会出现遗 ...

  2. 配置nginx支持php

    配置nginx支持php vi /usr/local/nginx/conf/nginx.conf      #编辑配置文件 user   www  www;          #首行user去掉注释, ...

  3. centos7.4下安装配置PHP服务(源码安装)并配置nginx支持php

    一.检查php是否已经安装,使用php -v,是否能够看到版本号,或者使用rpm -qa | grep php查看是否安装过. # yum remove php* -y 二.依赖包安装 Linux软件 ...

  4. nginx支持php5,配置nginx支持php

    配置nginx支持php vi /usr/local/nginx/conf/nginx.conf      #编辑配置文件 user   www  www;          #首行user去掉注释, ...

  5. centos7.4配置nginx php,centos7.4下安装配置PHP服务(源码安装)并配置nginx支持php

    一.检查php是否已经安装,使用php -v,是否能够看到版本号,或者使用rpm -qa | grep php查看是否安装过. # yum remove php* -y 二.依赖包安装 Linux软件 ...

  6. centos下配置nginx支持php

    添加nginx 默认主页index.php vim /etc/nginx/conf.d/default.conf location / { root   /usr/share/nginx/html; ...

  7. linux cgi c环境配置,Linux下配置nginx支持.cgi | 系统运维

    说明: 操作系统:CentOS 6.x web环境:php+nginx+mysql nginx安装目录:/usr/local/nginx nginx配置文件:/usr/local/nginx/conf ...

  8. 转载:配置nginx支持pathinfo功能

    原文地址:http://linuxguest.blog.51cto.com/195664/694319 nginx模式不支持pathinfo模式,类似info.php/hello形式的url会被提示找 ...

  9. CentOS Linux 7 配置 nginx 支持 CGI

    Nginx 本身不能执行外部程序,Nginx 处理 PHP 是通过 PHP 的 fastcgi 管理器(php-fpm)进行处理,然后 nginx 再将结果返回给用户:所以如果我们需要通过 cgi 程 ...

最新文章

  1. SNMP introduction
  2. 计算机录入技能考试题,计算机文字录入员高级技能考试试卷
  3. linux 脚本向标准输入,linux中的标准输出和输入
  4. iOS之仿QQ好友列表展开收缩效果的实现
  5. 【python教程入门】Python的机器学习库有哪些?
  6. Selenium私房菜系列8 -- 玩转Selenium Server
  7. 京东数科科创板IPO获受理,刘强东为实际控制人
  8. python打印文档添加条码_12行代码教会你用python读excel文件,提取数据,生成条形码...
  9. 初学linux网络服务之DHCP实验
  10. 陈绪:3月21日阿里云北京峰会专场出品人
  11. Listary 6 插件开发教程:使用 Javascript 开发
  12. 最强大的数据恢复软件
  13. 树莓派 kali系统默认密码
  14. LED MEO GTO GEO IGSO SSO概念
  15. python排序输出人名_005_015 Python 人名按字母排序,首字母分组 | 学步园
  16. 昆虫有趋光性?我来告诉你,并不是!
  17. 基于ssm jsp在线教育系统源码
  18. 学习CMake(一)
  19. Python中一般如何处理中文
  20. 超融合基础架构容灾 -Nutanix Metro Availability + VMwareHA容灾

热门文章

  1. ARM64的启动过程之(二):创建启动阶段的页表
  2. python字典中append_零基础入手!Python中字典与集合的使用指南
  3. 适合打游戏的计算机内存品牌型号,玩游戏电脑内存要多大合适?不同内存容量玩游戏区别实测...
  4. python元编程_Python 元编程
  5. 苏州市计算机音乐学会地点,苏州市音乐家协会小提琴学会成立
  6. 调用手机相机相册_如果你用华为手机拍照!记得开启专业模式,照片好看十倍不止...
  7. opencv 训练人脸对比_【项目案例python与人脸识别】基于OpenCV开源计算机视觉库的人脸识别之python实现...
  8. TextVQA论文汇总
  9. Ubuntu16.04下CUDA 9.0 + cuDNN v7.0 + tensorflow 1.6.0(GPU)环境搭建
  10. JZOJ__Day 5:【普及模拟】权势二进制