EC2 instance accessible through elastic IP but shows Nginx home page while using domain route 53

Viewed 20

So, I was doing a guided project building a django based website. Upon its completion I deployed it on AWS using EC2 instance uing nginx and gunicorn using this guide. I assigned an elastic IP to the instance and used route53 to use a domain name to access the website. Now the website is accessible through the elastic IP which is mentioned in my nginx proxy pass file to gunicorn but the nginx homepage opens up while using the domain name.

Nginx Proxy Code:

server {
listen 80;
server_name 15.206.3.159;

location = /favicon.ico { access_log off; log_not_found off; }

location / {
    include proxy_params;
    proxy_pass http://unix:/run/gunicorn.sock;
}}

My route 53 settings are: Route 53 settings

The nameservers were successfully added to the domain.

The page that shows up on visiting through domain name: on visiting domain

Could anyone help me with what exactly is going wrong here?

1 Answers

Add domain name in server name directive.

server {
listen 80;
server_name 15.206.3.159 lordpasta.tech;

location = /favicon.ico { access_log off; log_not_found off; }

location / {
    include proxy_params;
    proxy_pass http://unix:/run/gunicorn.sock;
}}

--

http to https redirection in the site -

ab@13 /tmp % curl -sI http://lordpasta.tech
HTTP/1.1 301 Moved Permanently
Server: nginx/1.18.0 (Ubuntu)
Date: Fri, 23 Sep 2022 07:17:14 GMT
Content-Type: text/html
Content-Length: 178
Connection: keep-alive
Location: https://lordpasta.tech/
Related