如何在AWS亚马逊云上运行Angular应用

这是我的亚马逊AWS登陆后的页面:

clipboard1

Using username “ubuntu”
Authenticating with public key “imported-openssh-key”
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-1021-aws x86_64)

  • Documentation: https://help. ubuntu.com
  • Management: https://landscape. canonical.com* Support:. https://ubuntu. com/advantage
    System information as of Thu Feb 28 07:09:50 UTC 2019
    System load: 0.0sage of /: 18.8% of 15.45GBMemory usage: 7%Swap usage: 0%
    Processes:
    Users logged in:
    IP address for etho:
    134
    1
  • ‘snap info’ now shows the freshness of each channel.Try ‘snap info microk8s’ for all the latest goodness
    Get cloud support with Ubuntu Advantage Cloud Guest:http://www.ubuntu.com/business/services/cloud
    Canonical Livepatch is available for installation.
    Reduce system reboots and improve kernel security. Activate at:

切换到AWS上存放angular应用的文件夹下,命令ng build,然后:

ng serve --port 3000 --host 0.0.0.0

clipboard2

然后就能看到Angular应用运行在AWS上了:
clipboard3

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

展开阅读全文

AWS授权问题中的Angular应用程序

09-28
<div class="post-text" itemprop="text"> <p>I have an app build on angularjs with laravel php serve as backend. The api request for login using facebook works on my workstation, but when I push to aws, the console log me an error:</p> <pre><code>http://example.com/api/me 401 (Unauthorized) </code></pre> <p>The json returned as:</p> <pre><code>message: "Please make sure your request has an Authorization header" </code></pre> <p>But there is Authorization in request header.</p> <p><a href="https://i.stack.imgur.com/qMuLu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qMuLu.png" alt="enter image description here"></a></p> <p>Checklist: - Database in config has been changed to RDS - Facebook site url has been changed to aws domain</p> <p>The error come from <code>Authenticate.php</code> from laravel</p> <pre><code><?php namespace App\Http\Middleware; use JWT; use Config; use Closure; use Illuminate\Contracts\Auth\Guard; class Authenticate { protected $auth; public function __construct(Guard $auth) { $this->auth = $auth; } public function handle($request, Closure $next, $role) { if ($request->header('Authorization')) { $token = explode(' ', $request->header('Authorization'))[1]; $payload = (array) JWT::decode($token, Config::get('app.token_secret'), array('HS256')); if ($payload['exp'] < time()) { return response()->json(['message' => 'Token has expired']); } $request['user'] = $payload; return $next($request); } else { return response()->json(['message' => 'Please make sure your request has an Authorization header'], 401); } } } </code></pre> <p>Thanks!!</p> </div>
©️2020 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值