dops57958 2011-09-08 12:12 采纳率: 0%
浏览 8
已采纳

Zend Framework附加获取NGINX的参数

I configured my NGINX for Zend in the following way (PHP 5.3 with fpm):

server {
root /home/page/public/;
index index.php index.html index.htm;

server_name localhost;

location / {
    try_files $uri $uri/ /index.php;
}

location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

location ~ /\.ht {
    deny all;
}
}

Now i want to process additional get params like: http://web.site/index?par=1

WIth my local dev system (Apache) it works fine but not under NGINX which did'T deliver the get params.

Anny suggestions?

Edit:

Now i use the following config which seems to work but i'm not happy with it since everybody suggests "use try_files whenever possible".

location / {
    if (!-e $request_filename) {
        rewrite  /(.*)$  /index.php?q=$1  last;
        break;
    }
}
  • 写回答

2条回答 默认 最新

  • dongxinpa3101 2011-09-08 20:16
    关注

    From Nginx docs ( http://wiki.nginx.org/HttpCoreModule#try_files):

    If you need args preserved, you must do so explicitly:

    location / {
       try_files $uri $uri/ /index.php?$args;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀