nginx重写为PHP restful api apache htaccess

我有一个使用Restful API教程的apache htaccess文件

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.*)$ api.php?rquest=$1 [QSA,NC,L] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.*)$ api.php [QSA,NC,L] RewriteCond %{REQUEST_FILENAME} -s RewriteRule ^(.*)$ api.php [QSA,NC,L] </IfModule> 

我的nginxconfiguration目前是:

 server { listen 80; server_name example.org; access_log /var/log/nginx/access.log main; location / { index index.php index.html index.htm; } error_page 404 /404.html; location = /404.html error_page 500 502 503 504 /50x.html; location = /50x.html # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # 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; } } 

如何使用重写规则将其转换为Nginxconfiguration? api.php位于root文件夹中。