如何修复Restler + Explorer + Nginx(给出404)

时间:2013-10-25 16:13:46

标签: nginx explorer restler

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

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

有RESTler + nginx + explorer工作的人想分享他的nginx配置吗?

1 个答案:

答案 0 :(得分: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;
...