2

我有 RESTler 和资源管理器使用 Apache,但它不适用于 Nginx。

API 工作正常(server.com/api/class 工作正常)但http://server.com/api/explorer/index.html给出了 Nginx 404。

任何使用 RESTler + nginx + explorer 的人想要分享他的 nginx 配置?

4

1 回答 1

1

我有使用 nginx 的资源管理器,我的配置:

root         /var/www/test/;

location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    if (!-f $document_root$fastcgi_script_name) {
        return 404;
    }

    fastcgi_pass   unix:/var/run/php5-fpm/socket.socket;
    fastcgi_index index.php;
    include fastcgi_params;
}

location /api {
    if (!-f $request_filename) {
        rewrite ^(.*)$ /api/index.php last;
    }

    if (!-d $request_filename) {
        rewrite ^(.*)$ /api/index.php last;
    }
}

fastcgi_param

fastcgi_param   QUERY_STRING            $query_string;
fastcgi_param   REQUEST_METHOD          $request_method;
fastcgi_param   CONTENT_TYPE            $content_type;
fastcgi_param   CONTENT_LENGTH          $content_length;

fastcgi_param   SCRIPT_FILENAME         $document_root$fastcgi_script_name;
fastcgi_param   SCRIPT_NAME             $fastcgi_script_name;
fastcgi_param   PATH_INFO               $fastcgi_path_info;
fastcgi_param   REQUEST_URI             $request_uri;
fastcgi_param   DOCUMENT_URI            $document_uri;
fastcgi_param   DOCUMENT_ROOT           $document_root;
...
于 2013-10-26T03:17:52.153 回答