Nginx URL重写问题500内部服务器错误

Nginx URL重写问题500内部服务器错误,nginx,Nginx,我的脚本可以在localhost和cpanel上正常工作,但是当我将它放在Nginx上时,它会给出500个内部服务器错误 我的URL与此示例类似 http://localhost/scriptfolder/administration/main?mod=customer&P=All http://localhost/scriptfolder/administration/main?mod=customer&P=Edit&uid=2 当前.htaccess哪个工作正常 R

我的脚本可以在
localhost
cpanel
上正常工作,但是当我将它放在
Nginx
上时,它会给出500个内部服务器错误

我的URL与此示例类似

http://localhost/scriptfolder/administration/main?mod=customer&P=All
http://localhost/scriptfolder/administration/main?mod=customer&P=Edit&uid=2
当前
.htaccess
哪个工作正常

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* $0.php [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index\.php($|\ |\?)
RewriteRule ^(.*)/$ /$1.php [L,R=301]
但在Nginx上,我尝试了所有这些命令,但没有任何东西像上面的例子那样对我有效

location / {
    #try_files $uri/ $request_uri.php$is_args$args;
    #rewrite ^/(.*)$ /$request_uri.php last;
    try_files $uri $uri/ /index.php$request_uri;
}
我也试过这个,但没有成功

location / {
  if (!-e $request_filename){
    rewrite ^(.*)$ /$0.php break;
  }
  rewrite ^/(.*)/$ /$1.php redirect;
}
请帮我做这件事,我怎样才能修复它?我缺少什么