【发布时间】:2017-03-05 23:00:49
【问题描述】:
我在我的 Apache Web 服务器上部署了一个 Angular2 应用程序,并使用以下 .htaccess,
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^ index.html [L]
</IfModule>
以及 index.html 中的附加配置,
<base href="/applicationName/">
应用程序能够毫无问题地加载,也没有重定向问题。
我现在正尝试在我的 Nginx 服务器中设置相同的应用程序,但我似乎无法让它工作。
我知道 Nginx 中没有 .htaccess,如何将上面的 .htaccess 转换为在 Nginx 主配置中工作?
非常感谢!
【问题讨论】:
-
有人吗?谢谢!
-
这个问题已经被完整地记录在 Angular 文档中:Routed apps must fallback to index.html
标签: apache .htaccess angular nginx