您好我想建立的角4應用程序,步驟,其次是低於 -如何在nginx或apache httpd中構建角度爲4的應用程序?
構建ng build
在我運行的Apache我的Amazon EC2實例。隨後的步驟 -
#!/bin/bash
yum install httpd -y
yum update -y
cp dist/* /var/www/html/
service httpd start
chkconfig httpd on
一切正常,但我的應用程序使用auth0
進行身份驗證,我看到他們回調http://ip/callback
我的應用說 - 404未找到。
我試圖建立類似ng build --base-href .
,它沒有工作! Please help me how to build this one, please note that when I use
納克serve`在我的本地一切工作真棒。但是當我嘗試將其部署到生產中時,會出現此錯誤。我非常確定在構建應用程序時我正在做錯的事情。
我試過nginx
碼頭集裝箱,它給出了同樣的錯誤。我的碼頭文件看起來像這樣。
FROM nginx COPY dist /usr/share/nginx/html
- 搬運工構建-t NG-auth0-web開發。
- 搬運工運行-d -p 8080:80 NG-auth0-web開發
什麼不對上述搬運工文件?
https://github.com/auth0-samples/auth0-angular-samples/tree/master/01-Login - 示例應用程序代碼
https://manage.auth0.com/#/logs - No error in logs, that means auth0 is working fine but I am getting build error with angular.
確切錯誤:
更新 -
我試圖建立這樣也 - ng build --base-href http://34.213.164.54/
和ng build --base-href http://34.213.164.54:80/
,但是同樣的錯誤。
所以問題縮小到我如何建立角應用
public handleAuthentication(): void {
this.auth0.parseHash((err, authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
window.location.hash = '';
this.setSession(authResult);
localStorage.setItem('email', profile.email);
this.verticofactoryService.registerUser(u);
this.router.navigate(['/home']);
});
} else if (err) {
this.router.navigate(['/home']);
console.log(err);
alert(`Error: ${err.error}. Check the console for further details.`);
}
});
}
爲什麼你期望的請求/回調給予比404其他什麼嗎?您是否配置了Apache來爲該URL提供任何內容? –
是的,我正在請求/ /回調將驗證用戶。我沒有在apache中配置任何東西。沒有別的,我遵循上述步驟。你可以給我一個例子嗎 ? – irobo
一個什麼樣的例子?當/ callback請求到達服務器時應該發生什麼? –