我们正在将当前的angular2 app从iis移动到nginx。请帮我改写nginx中的以下规则。
的web.config
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite static files to content" stopProcessing="true">
<match url="(?:\.css|\.js|\.html|\.eot|\.woff2|\.woff|\.ttf|\.jpg|\.png|\.gif|\.svg)$" />
<action type="Rewrite" url="/{SCRIPT_NAME}" />
</rule>
<rule name="frontend">
<match url="(?:\.css|\.js|\.html|\.eot|\.woff2|\.woff|\.ttf|\.jpg|\.png|\.gif|\.svg|\.txt|api/v1/Admin)" negate="true" />
<action type="Rewrite" url="index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
Nginix配置: 这是我目前的nginx配置文件。
<code>
server {
listen 80;
sendfile on;
default_type application/octet-stream;
root /usr/share/nginx/html;
location ~ \.css$ {}
location ~ \.js$ {}
location / {
alias /usr/share/nginx/html/myplanningui/;
try_files $uri$args $uri$args/ /myplanningui/index.html;
}
location /myplanningui {
alias /usr/share/nginx/html/myplanningui/;
try_files $uri$args $uri$args/ /myplanningui/index.html;
}
location /myplanningui/ {
alias /usr/share/nginx/html/myplanningui/;
try_files $uri$args $uri$args/ /myplanningui/index.html;
}
}
</code>