简体   繁体   English

将Apache迁移到Nginx时无法重写

[英]Can't ReWrite when migrate Apache to nginx

I want to change one of my server Apache to nginx+php-fpm but there is a little problem that using rewrite. 我想将我的服务器Apache之一更改为nginx+php-fpm但是使用重写存在一个小问题。 Requests come like this /dispatcher.php/foo/foo/foo/1 请求是这样的/dispatcher.php/foo/foo/foo/1

I couldn't decide how can i send this request to php-fpm because when I send this request to php-fpm i get not found error. 我无法决定如何将该请求发送到php-fpm因为当我将此请求发送到php-fpm我找不到错误。 There is no file or path like this but i must send whole url like this and dispatcher.php get and process this url. 没有这样的文件或路径,但是我必须发送整个URL,然后dispatcher.php获取并处理该URL。

try adding a location block like so: 尝试添加一个位置块,如下所示:

location /dispatcher.php/ {
  fastcgi_param SCRIPT_FILENAME /path/to/dispatcher.php;
  #rest of your fastcgi bits go here
}

to your fastcgi directives (obviously replacing the path to point to your actual dispatcher.php location) 到您的fastcgi指令(显然替换了指向您实际的dispatcher.php位置的路径)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM