title: How to rewrite the IIS web.config rewrite rules in nginx
body: <p>We are moving current angular2 app from iis to nginx. Please help me in rewriting the following rules in nginx.</p>
  
  <p>web.config</p>
  
  <pre><code>&lt;configuration&gt;
  &lt;system.webServer&gt;
      &lt;rewrite&gt;
        &lt;rules&gt;
          &lt;rule name="Rewrite static files to content" stopProcessing="true"&gt;
            &lt;match url="(?:\.css|\.js|\.html|\.eot|\.woff2|\.woff|\.ttf|\.jpg|\.png|\.gif|\.svg)$" /&gt;
            &lt;action type="Rewrite" url="/{SCRIPT_NAME}" /&gt;
          &lt;/rule&gt;
          &lt;rule name="frontend"&gt;
              &lt;match url="(?:\.css|\.js|\.html|\.eot|\.woff2|\.woff|\.ttf|\.jpg|\.png|\.gif|\.svg|\.txt|api/v1/Admin)" negate="true" /&gt;
              &lt;action type="Rewrite" url="index.html" /&gt;
          &lt;/rule&gt;
        &lt;/rules&gt;
      &lt;/rewrite&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p></p>
  
  <p>Nginix Config: 
  This is my current nginx config file.</p>
  
  <pre><code>&lt;code&gt;
  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;
    }
  }
  &lt;/code&gt;
  </code></pre>