您好我想建立的角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请求到达服务器时应该发生什么? –