Domain does not work without dot in the en

25 views Asked by At

Why my domain works only when I type this: example.com. with a "dot" and without "www" and in any other condition I get 400 error:

http://example.com./ - it works
http://www.example.com/ - it doesn't work
http://www.example.com./ - it doesn't work

Error I get: GET http://www.example.com./ 400 (Bad Request)

I use: django, aws, route53, ec2, ubuntu, nginx, gunicorn

I followed this tutorial 1:1:

I set up:

  1. elastic IP for my instance and connnect to my instance.

  2. In hosted zone I did like in tutorial:

    Record name: example.com Record type: A Value: my IP Alias: No TTL (seconds): 300 Routing policy: Simple

and

> Record name:
> www.example.com
> Record type:
> A
> Value:
> example.com.
> Alias:
> No
> TTL (seconds):
> 900
> Routing policy:
> Simple

3)Nginx conf:

```
server {     
listen 80 default_server;     
server_name example.com www.example.com myIP;}
```

then restart:

```
sudo systemctl restart nginx 
sudo service gunicorn restart 
sudo service nginx restart
```
  1. Settings.py:

    ALLOWED_HOSTS = [ 'example.com','myIP', ]

Thanks in advance!

0

There are 0 answers