【发布时间】:2018-08-12 11:17:13
【问题描述】:
我有一个在 NodeJS 服务器上运行的 Angular 5 应用程序,我想在 website.com/sitemap/sitemap-cats.xml 和 example.com/sitemap/sitemap-dogs.xml 呈现我的站点地图
我的站点地图位于/home/root/sitemap 文件夹。
我尝试如下配置/nginx/sites-available/default 的位置块,因此它会在加载 Angular 应用程序之前呈现站点地图。
# Sitemap Locations
location /sitemap/sitemap-cats.xml {
alias /home/root/sitemap/sitemap-cats.xml;
}
location /sitemap/sitemap-dogs.xml {
alias /home/root/sitemap/sitemap-dogs.xml;
}
问题是上面的配置不起作用,因此 Angular 应用程序显示 404 错误。
甚至可以在 Angular 应用加载之前渲染这些 .xml 文件吗?
【问题讨论】:
标签: node.js angular nginx nginx-location