VPS侦探论坛

 找回密码
 注册
查看: 7446|回复: 2

请问军个如何让LNMP1.0支持PATHINFO

[复制链接]
发表于 2013-9-12 04:10:34 | 显示全部楼层 |阅读模式

请问军个如何让LNMP1.0支持PATHINFO,在网上找了很多写法,貌似都不支持LNMP1.0
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2013-9-12 17:50:18 | 显示全部楼层


试试用这个添加域名看,看是否可行。

  1. wget http://vps.idc886.com/vhost0.sh;sh vhost0.sh
复制代码


中间加了支持 pathinfo 路径代码
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2013-9-12 20:05:15 | 显示全部楼层

ssh里执行:
  1. cat > /usr/local/nginx/conf/pathinfo.conf << 'EOF'
  2. set $real_script_name $fastcgi_script_name;
  3. if ($fastcgi_script_name ~ "(.+?\.php)(/.*)") {
  4. set $real_script_name $1;
  5. set $path_info $2;
  6. }
  7. fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
  8. fastcgi_param SCRIPT_NAME $real_script_name;
  9. fastcgi_param PATH_INFO $path_info;
  10. EOF
复制代码


再将虚拟主机配置文件里的location ~ .*\.(php|php5)?$ 替换为:location ~ .*\.php


再在include fcgi.conf; 下面添加一行include pathinfo.conf;

重启nginx

完整的虚拟主机配置文件如下:

  1. server
  2.         {
  3.                 listen       80;
  4.                 server_name www.lnmp.org;
  5.                 index index.html index.htm index.php;
  6.                 root  /home/wwwroot/lnmp;

  7.                 location ~ .*\.php
  8.                         {
  9.                                 try_files $uri =404;
  10.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  11.                                 fastcgi_index index.php;
  12.                                 include fcgi.conf;
  13.                                 include pathinfo.conf;
  14.                         }

  15.                 location /status {
  16.                         stub_status on;
  17.                         access_log   off;
  18.                 }

  19.                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  20.                         {
  21.                                 expires      30d;
  22.                         }

  23.                 location ~ .*\.(js|css)?$
  24.                         {
  25.                                 expires      12h;
  26.                         }

  27.                 access_log  /home/wwwlogs/lnmp.log  lnmp;
  28.         }
复制代码
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-25 01:23 , Processed in 0.026269 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表