Sakibdevlekar / angular_ionic_deployment

How to depoly angular, ionic app on aws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular_ionic_deployment

1. Setup your ec2 instance

  • Setup ec2 instance by selecting os image and instance type

2. Clone your project from GitHub

    sudo git clone <user repo link>

3. Copy the (www or your build folder) into this directory /var/www/html/

- Note: delete all files from html folder

    sudo cp -a /home/ubuntu/<your folder name>/www/*  /var/www/html/

4. Change the security setting for accessing your website

WhatsApp Image 2023-10-09 at 1 18 04 PM

Then click on edit inbound rule and add some rules

  • Add same rule shown in the image

image

5. Install NGINX and configure

   sudo apt install nginx
   sudo nano  /etc/nginx/sites-available/default 
  • Add the following to the location part of the server block

    server {
          listen 80 default_server;
          listen [::]:80 default_server;
    
          root /var/www/html;
    
          index index.html ;
    
          server_name _;
    
          location / {
    
                  try_files $uri $uri/ /index.html  =404;
          }
    

    - Check NGINX config

       sudo nginx -t
    

    - Restart NGINX

       sudo systemctl restart nginx
    

    Check sites-enabled and sites-available files data are the same. To check sites-enabled

    sudo nano  /etc/nginx/sites-enabled/default 
    
  • Again restart nginx

       sudo systemctl restart nginx
    

    - Check status of NGINX

       sudo systemctl status nginx
    

    6. Now copy past the public IP of your instance your site home page is visible now which means your app is hosted successfully ✨

About

How to depoly angular, ionic app on aws