在一个子目录下的nginx重写规则

我有一个WordPress网站,在一个子目录下运行nginx。 我怎么能写一个子目录重写规则? 或任何人都可以请转换这个Apache重写规则? 我到处search关于nginx重写规则,但没有任何工作!

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /main/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /main/index.php [L] </IfModule> 

任何帮助表示感谢,谢谢

尝试使用这个,请不要忘记取代根路径!

 location /main/ { root /full/path/from/root/main/; try_files $uri $uri/ /index.php?$args; } 

我已经在我的主机上设置WordPress的文件夹/主,并得到它与下一个设置工作:

 location /main { index index.php; try_files $uri $uri/ /main/index.php?q=$uri; } root /path/to/webroot;