私は角度のアプリケーションがあります。 distフォルダを生成するには、ng build --prod --aot
というコマンドを実行します。 は私がStaticfileという名前のファイルを作成したdistのフォルダで、私は次のコマンドを使用してpivotal.ioへのdistフォルダをアップロード:404が見つかりませんnginx angular 4ルーティング
- CFプッシュ名-アプリを--no-開始
- CFは名前のアプリを起動します
アプリが正常に動作します。私はnav barを持っているので、navbarでパスを変更するとすべて正常に動作します。しかし、私は手動で(私は自分自身にURLを入力する)このエラーがある404見つかりませんnginx。 これは私のapp.component.ts:
const appRoutes: Routes = [
{ path: 'time-picker', component: TimePickerComponent },
{ path: 'material-picker', component: MaterialPickerComponent },
{ path: 'about', component: AboutComponent },
{ path: 'login', component: LoginComponent },
{ path: 'registration', component: RegistrationComponent },
{
path: '',
redirectTo: '/time-picker',
pathMatch: 'full'
}
];
@NgModule({
declarations: [
AppComponent,
TimePickerComponent,
MaterialPickerComponent,
DurationCardComponent,
AboutComponent,
LoginComponent,
RegistrationComponent,
],
imports: [RouterModule.forRoot(
appRoutes
// ,{ enableTracing: true } // <-- debugging purposes only
),
FormsModule,
BrowserAnimationsModule,
BrowserModule,
MdCardModule, MdDatepickerModule, MdNativeDateModule, MdInputModule
],
providers: [{ provide: DateAdapter, useClass: CustomDateAdapter }],
bootstrap: [AppComponent]
})
export class AppModule {
constructor(private dateAdapter: DateAdapter<Date>) {
this.dateAdapter.setLocale('fr-br');
}
}
EDIT
は静的ビルドは自分のアプリケーションには向いていないですか?いったん角型アプリケーションがプロダクトの準備ができたら、次に何をすべきでしょうか?すべてのあなたの反応は私がすでにバックエンド側を持っていると仮定します。あなたは慎重に私の記事を読んでくださいできますか?
これに従ってくださいは、HTTPS:/ /stackoverflow.com/a/40833154あなたのnginx設定ファイルを更新するには – Brilliant