Application Tier
- First, we need zip code then copy to EC2 Public

- Check received or not

- Copy backend.zip to EC2 Private - Application

SSH to EC2 Private - Application and check

Install unzip then unzip backend.zip

- Create user backend, create directory /projects and move folder backend to

- chown, chmod folder backend, check

- Install python, pip, venv

- Create virtualenv - environment for python to run the project, then activate this virtual environment

- Install project’s dependencies
pip install -r requirements.txt

- Change ip database to Database tier’s ip

- Run project, error with database

- Change Security Group Private Subnet, add rule TCP port 27017 of MongoDB

- Run project again, successful

- Then, we use nginx as revert proxy for backend, install

- Create a new file, name as fastapi_nginx in the direct : /etc/nginx/sites-enabled/ , has this content :

- Checking syntax of nginx and restart

- Restart project, now nginx is running as revert proxy, forward request from port 80 to port 8000.
