启用了AngularJS和html5mode的Nginx重写规则

时间:2013-01-22 12:56:01

标签: url-rewriting nginx routing rewrite angularjs

到目前为止,我正在构建使用nginx服务的AngularJS应用程序。我在中间有轨道,我带有rewrite ^/(?!assets) / last;重写规则(重写所有期望以资产开头的东西),到目前为止它正在工作 - 使用rails:

   server {
      listen 80;
      server_name ies.local;
      root /home/jk/Projects/ies12/webapp/public;   # <--- be sure to point to 'public'!
      passenger_enabled on;
      rails_env development;
      rewrite ^/(?!assets) / last;
    }

但到了今天,我离开了轨道,我需要扩展这条规则..

如果我做的话

server {
  listen 80;
  server_name webapp.local;
  root /home/jk/Projects/webapp;
  rewrite_log on;

  rewrite ^/(?!angular) / last;
  rewrite ^/(?!angular-ui) / last;
}

只有webapp / index.html文件 得到:

*1 rewrite or internal redirection cycle while internally redirecting to 
"/index.html", client: 127.0.0.1, server: webapp.local, request: "GET / HTTP/1.1", host: "webapp.local"

0 个答案:

没有答案