Wildcard domain to catch all subdomains with Nginx

I found some topics related to my question but they are not clear enough for me.

I have a large list of subdomains and the list continues to grow.

I recently started using Digital Ocean and I need to recreate the list of subdomains but the process of creating them one by one using the DNS Server control panel is very time consuming and besides that, whenever I need to create a new subdomain I will have to do it manually.

I’m trying to create a wildcard domain so that all subdomains are captured by the DNS server and then each one is redirected to the specific service.

The service that will be used is Odoo and it will work together with Nginx.

What I’ve done so far:

In the DNS control panel at Digital Ocean, I created the following DNS records (including a * - wildcard domain):

A     *  3600
CNAME      43200
A  3600
NS 1800
NS 1800
NS 1800

For the records “” and “” everything seems to be working because when I ping I see that the traffic is redirected to the Digital Ocean droplet.

In Nginx I created a server block and included as servers:

server {

 server_name *;


With this configuration, I can easily access the Odoo server using the addresses: and but when I try to access the address “” I cannot access the server.

Surely it will be necessary to perform some more step that passed me and I didn’t find in my searches?

Can anyone help me please?

Thank you in advance

Submit an answer
Answer a question...

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.

I faced same problem. Did you find solution?

Bobby Iliev
Site Moderator
Site Moderator badge
July 17, 2022

Hi there,

The configuration actually looks all correct. Did you way 24/48 hours for the DNS caching to clear over the Globe? To quickly check if any of your subdomains are actually pointing to the correct IP, you can using the ping command:


If the IP address matches the IP address of your server, can you confirm what is the exact error that you get when you visit the subdomain via your browser.

Usually as long as you have the * A record and the * server_name it should all work as expected.