Question works, * returns Bad Request, and does not connect

The site loads when I visit the droplet IP address and

When I go to, Chrome reports:

This site can’t be reached’s server IP address could not be found."

When I try *, for instance or, it responds with Bad Request (400). Same responses on MS Edge.

I’ve followed these links, amongst others:

How To Set Up Django with Postgres, Nginx, and Gunicorn on Ubuntu 16.04 How To Set Up and Test DNS Subdomains with DigitalOcean’s DNS Panel Subdomains not working with Digital Ocean DNS settings Why isn’t my site available via the www prefix?

I’m trying to deploy a Mezzanine 4.2.3 CMS using Ubuntu 16.04.3, Python 3.5.2, gunicorn, and nginx. I elected not to use the provided by Mezzanine because it didn’t work and I couldn’t figure out all the things that I had to attend to get it right. It was far easier to get running with the first DigitalOcean tutorial linked above.

I’ve placed the IP address,, *, and in ALLOWED_HOSTS in (temporarily; will follow two scoops best practices once I get a better handle on deployment):

    "IP address",

I’ve also placed them in /etc/nginx/sites-available/project:

server {
listen 80;
server_name [IP address] *;

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/project;

location / {
include proxy_params;
proxy_pass http://unix:/home/project/project.sock;

I’ve added an A record for pointing to the IP address of the droplet and it’s successful. When I go to the IP address or, the site shows.

Fearing conflicts, I tried these permutations:

Scenario 1:, *

Scenario 2: A:,

Scenario 3: A:,, *

Scenario 4: A: CNAME: *

Scenario 5: A: CNAME:

Scenario 6: A:, * CNAME: *

Scenario 7: A:, CNAME:

Scenario 8: A:, *, CNAME: *

Scenario 9: A:, *, CNAME:

Scenario 10: A:, *, CNAME: *,

Scenario 11: A: CNAME: *,

The results were the same for all 11 scenarios. I am leaving things at Scenario 11.

Along the way, I pinged the IP address,, *, and from the command line. It’s always successful for the IP address,, and even * They invariably got a reply from the IP address. However, the response for

Ping request could not find host Please check the name and try again.

When I tried host <*> +trace, it traced all the way down properly.

When I tried host <*>, it gave me the correct IP address.

I’m out of ideas. What could I have missed?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Someone advised me to rework my DNS:


And to edit my nginx config:

# Add this server block to rewrite subdomains
server {
listen 80;
server_name *;
location / {
rewrite ^;

# Delete * and from this server block
server {
listen 80;
server_name [droplet IP address];

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/example;

location / {
include proxy_params;
proxy_pass http://unix:/home/example/example.sock;

ALLOWED_HOSTS should have: droplet IP address,, and *

It worked!

Thank you so much for the explanation!

I had the same issue and it worked for me too, THANKS AGAIN!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel