When using an AWS Load Balancer (ELB) with SSL termination, the ELB manages incoming traffic on port 443 and forwards it to NGINX on port 80. In this case, NGINX will be unaware of the original HTTPS request, as the load balancer handles SSL termination.
Step 1: Install Nginx on EC2
SSH into your EC2 instance.
Run the following commands to install Nginx:
sudo apt update sudo apt install nginx -y
Step 2: Configure Nginx for Reverse Proxy
Open the Nginx configuration file:
sudo nano /etc/nginx/sites-available/default sudo cat /etc/nginx/sites-available/default
Replace the default configuration with a reverse proxy configuration for your frontend and backend. Here’s an example setup:
server { listen 80; server_name 13.53.38.238;
}
Step 3: Test and Restart Nginx
Test the Nginx configuration to ensure there are no syntax errors:
If everything is OK, restart Nginx to apply the new configuration:
Check the status
Reload to apply all the changes
If everything is ok, the site is been rendered in http://13.53.38.238
Step 4: Nginx after set up app.lhainmobiliaria.es
When using an AWS Load Balancer (ELB) with SSL termination, the ELB manages incoming traffic on port 443 and forwards it to NGINX on port 80. In this case, NGINX will be unaware of the original HTTPS request, as the load balancer handles SSL termination.
The new Nginx document will be:
server { listen 80;
}
Test the Nginx configuration to ensure there are no syntax errors:
If everything is OK, restart Nginx to apply the new configuration:
Check the status
Reload to apply all the changes
The site should be rendering in https://app.lhainmobiliaria.es