【发布时间】:2019-12-13 09:23:07
【问题描述】:
我有一个 Angular 应用程序。在开发过程中一切正常,但是在构建之后,我遇到了如下所述的错误:
我有一条通往“/profile”的路线
如果我直接点击 url,它会显示“未指定输入文件”。在我的宅基地上并在生产服务器上显示“500 internal server error”
但是,如果我通过单击链接导航到该 url,它运行良好并且可以很好地显示“/profile”页面。
import { Routes } from '@angular/router';
import { ProfileComponent } from './profile.component';
export const PagesRoutes: Routes = [
{
path: 'profile',
component: ProfileComponent
}];
我真的不知道问题出在哪里。它在开发过程中运行良好
【问题讨论】:
-
您的服务器在什么平台上运行?它是一个什么样的应用程序?
-
无法访问路径
/profile,因为应用程序尚未加载,您需要编辑.htaccess以将任何路径重定向到/index.html -
顺便说一句,它应该在生产中返回
404而不是500,除非它使用了一些index.php,这会导致500错误 -
正如@Hussein 所建议的,您需要将所有到达某个URI 的请求转发到角度应用程序。这是一个不同的问题,但我在这里提到了您遇到的问题:stackoverflow.com/questions/49022951/…
-
@BunyaminCoskuner 我正在访问构建应用程序 nginx 版本:nginx/1.15.5
标签: angular