3

我正在尝试在我的本地机器(Win8x64)上设置 Zurmo CRM。安装完所有要求后,我想开始实际安装。问题是路径似乎没有正确地从 NGinx 传递到 FastCGI PHP。这是我的 Nginx 服务配置:

server {

    listen       80;
    server_name  zurmo.local;
    root         html/zurmo.local;
    set $index   "index.php";

    charset utf-8;

    location / {
        index  index.html $index;
        try_files $uri $uri/ /$index?$args;
    }

    location ~ ^/(protected|framework|themes/\w+/views) {
        deny  all;
    }

    location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
        try_files $uri =404;
    }

    location ~ \.php {

        fastcgi_split_path_info  ^(.+\.php)(.*)$;

        set $fsn /$index;
        if (-f $document_root$fastcgi_script_name){
            set $fsn $fastcgi_script_name;
        }

        fastcgi_pass   127.0.0.1:9000;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fsn;
        fastcgi_param  PATH_INFO        $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED  $document_root$fsn;
    }

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

结果,当我调用 zurmo.local (添加到主机文件)时,我得到“这个网页有一个重定向循环”,其 URI 看起来像这样http://zurmo.local/app/app/ [...] /app/app/index.phpIf 而不是,$document_root$fsn我评论了PATH_INFOand 而PATH_TRANSLATED不是我得到No input file specified.的一个看起来像的 URIhttp://zurmo.local/app/app/index.php

进一步研究它,当我添加access_log html/zurmo.local/logs/access.log;Nginx时,我会error.log看到以下内容:[timestamp] [emerg] 4064#3660: CreateFile() "[path to stack]\nginx/html/zurmo.local/logs/access.log" failed (3: The system cannot find the path specified). 如您所见,目录分隔符不一致。

最后一点,我的 Nginx 主目录位于nginx/html它实际上是一个 smlink,../home这纯粹是为了保持我的文件结构适合我的日常工作。

如何正确配置 Nginx 以继续(使用 Zurmo 安装)?

4

2 回答 2

2

我知道这是一个老问题,但这是我为使 nginx + zurmo 工作所做的工作。

server {
    listen       80;
    server_name  zurmo.local;
    root         /home/www/zurmo.local;
    access_log   /var/log/nginx/zurmo.access.log main;
    index index.php;

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

    location ~ ^/(protected|framework|themes/\w+/views) { deny all; }
    location ~ /\. { deny all; access_log off; log_not_found off; }
    location = /favicon.ico { log_not_found off; access_log off; }
    location ~ \.(js|css|png|jpg|gif|ico|pdf|zip|rar)$ {
        try_files $uri =404;
    }

    location ~ \.php {
        fastcgi_split_path_info  ^(.+\.php)(.*)$;

        fastcgi_param  PATH_INFO        $fastcgi_path_info;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi_params;

        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;

        fastcgi_read_timeout 600s;
        fastcgi_send_timeout 600s;
    }
}
于 2014-03-30T15:11:23.223 回答
0

我认为你不需要if()在你的*.php块中声明。在我的 nginx 设置中,这就是我所需要的:

# Process PHP files
location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;

    # Include the standard fastcgi_params file included with nginx
    include fastcgi_params;

    fastcgi_param  PATH_INFO        $fastcgi_path_info;
    fastcgi_index index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

    fastcgi_pass 127.0.0.1:9000;
}
于 2013-07-07T09:50:13.080 回答