0

Right, I have a Django powered website which I am now ready to deploy into production. Except it keeps coming back with the default NGINX page - which I knew about already.

The tutorial is as follows, and I successfully accessed my website using the IPV4 address.

YouTube Tutorial

I have set up a Route53 in my AWS account to manage my DNS configurations, I have an EC2 Instance & I have configured the NS records - issued by Route52 - in the NameServer section of Ionos (where I obtained mt domain from).

I have also conducted an A test on my Route53 and it returns no errors with with the response being my correct IPV4 address for my Amazon EC2 instance.

I have also set up an SSL certificate (with a record set up in my Route53 account for the wildcard of *.domain.com) and set up a 443 port for https access in my NSG.

My Django config file is as follows:

server{

    listen 443; #FOR HTTPS ACCESS
    server_name domain.com www.domain.com;

    
    location / {

        include proxy_params;
        proxy_pass http://unix:/home/ubuntu/.ssh/xxx/app.sock;

    }

}

This has been saved and the command sudo service nginx restart was ran. I even rebooted my EC2.

My Inbound NSG rules for me EC2 instance are as follows:

8000    TCP 0.0.0.0/0   
80  TCP 0.0.0.0/0   
443 TCP 0.0.0.0/0   
22  TCP 0.0.0.0/0

My Outbound NSG rules are as follows:

All All 0.0.0.0/0

My Route53 configurations are as follows:

domain.com  A   Simple  -   No  <EC2 IPV4>  -   
domain.com  NS  Simple  -   No  NAME RECORDS
domain.com  SOA Simple  -   No  ns-442.awsdns-55.com. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400
_e16770634889b3410235a7c4e78692ef.domain.com    CNAME   Simple  -   No  _1d0b7a786e77efdbda8a9003fdd15429.sdgjtdhdhz.acm-validations.aws.
www.domain.com  A   Simple  -   No  <EC2 IPV4>

The only error logs are as follows:

2024/05/17 11:47:33 [emerg] 1248#1248: no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/django.conf:1

With this in mind, why does AWS continue to show the default NGINX page despite me telling it to show my website?

8
  • Do you have anything in your logs when it serves a default web page? Are you sure this config snippet with your defined server block is respected (loaded) into your Nginx (check with nginx -T)? Commented May 17 at 12:34
  • @NikitaKipriyanov Yes, syntax is ok, test is successful
    – JoJoJohan
    Commented May 17 at 12:44
  • I asked not whether syntax is correct (it is, since Nginx was starting), I asked whether your snipped is included into the consolidated config at all. It is, since it produced this error. And yes, until you fix this error (by providing a certificate) this virtual server can not possibly work. Commented May 17 at 13:03
  • Well I have provided the certificate. The certificate - according to AWS Certificate Management - has been successfully verified and issued. So why is is my website not loading? Why is is it not doing as it's told?
    – JoJoJohan
    Commented May 17 at 13:10
  • To provide a certificate for such a configuration you must have your certificate file, the private key, and the certificate trust chain directly on the server, and specify it in the config. Read you error message, it even says which configuration directive is missing. Search Nginx manual about that directive to know more. RTFM, do your homework. // Maybe you have something (NSG?) that does reverse proxying and SSL striping for you? Then you must not create SSL virtual server, create a plain HTTP one; all the encryption is done by reverse proxy in such a configuration. Commented May 17 at 13:41

0

You must log in to answer this question.