将文件夹重写规则从apache转换为nginx

将文件夹重写规则从apache转换为nginx,apache,.htaccess,mod-rewrite,nginx,Apache,.htaccess,Mod Rewrite,Nginx,以下是我现有的Apache htaccess规则: <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteRule ^$ myapp/webroot/ [L] RewriteRule (.*) myapp/webroot/$1 [L] </IfModule> 所以基本重写现在可以工作了,但问题是,上面提到的apache文件夹中的文件现在在根级别被调用(而不是

以下是我现有的Apache htaccess规则:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteBase /
   RewriteRule    ^$ myapp/webroot/    [L]
   RewriteRule    (.*) myapp/webroot/$1 [L]
</IfModule>
所以基本重写现在可以工作了,但问题是,上面提到的apache文件夹中的文件现在在根级别被调用(而不是从上面提到的文件夹),这会导致这些文件出现404个错误

如何将Apache规则正确导入到我的nginx配置中?

解决了这个问题: nginx root指令只需要更改为apache文件夹

location / {
root /var/www/example.com/html;
try_files $uri $uri/ /index.php$is_args$args;
}