将lighttpd别名重写规则转换为nginx别名重写规则

时间:2019-06-11 07:46:09

标签: nginx lighttpd

我想将此lighttpd重写规则转换为nginx重写代码。

alias.url += ( "/ui/" => "/usr/local/opnsense/www/" )
alias.url += ( "/api/"  => "/usr/local/opnsense/www/" )
url.rewrite-if-not-file = ( "^/ui/([^\?]+)(\?(.*))?" => 
"/ui/index.php?_url=/$1&$3" ,
"^/api/([^\?]+)(\?(.*))?" => "/api/api.php? 
_url=/$1&$3"
)

我尝试了以下代码,但无法正常工作

location /ui/ {
    alias /usr/local/opnsense/www/;
    rewrite ^/ui/([^\?]+)(\?(.*))? /ui/index.php?_url=/$1&$3 last;
}
location /api/ {
    alias /usr/local/opnsense/www/;
    rewrite ^/api/([^\?]+)(\?(.*))? /api/api.php?_url=/$1&$3 permanent;
}

0 个答案:

没有答案