How should I correctly set up DNS for multiple subdomains?

Hi All,

Disclaimer: As a new poster I am limited to “links” I can add to my post, so I can’t put examples of the domains I am having issues with so have had to mask them with [domain as above], this will refer to the example domain I reference below.

I have a domain which we have a lot of WIP on at the moment, for the sake of this question, lets pretend my domain was

So I have this set up as follows (where IP’s is set correctly to the relevant server):

A [domain as above]
CNAME www [domain as above]

Now I have a number of subdomains, which are currently on a variety of different servers:
A staging
A workers
A development

Staging works, Workers works but development re-directs to workers.

Now, these two sites are located on the same server but in separate directories.

What have I done wrong? Is this an incorrect DNS setting or could it be down to my NGINX set up?

It sounds like an NGINX config issue. To make sure, set those DNS entries to :grey: so you’re going direct to server. Once you get that working, switch it back to :orange:.

1 Like

I have tried this, but I can’t see what is wrong with my NGINX config. I use Laravel Forge that sets up the servers for me, and…supposedly…the NGINX settings correctly.

Settings below for one site, the other is the same but different pathname:

include forge-conf/*;

server {
    listen 80;
    listen [::]:80;
    root /home/forge/;

    # ssl_certificate;
    # ssl_certificate_key;

    ssl_protocols TLSv1.2;
    ssl_ciphers *HIDDEN*
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    include forge-conf/*;

    location / {
        try_files $uri $uri/ /index.php?$query_string;

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

    access_log off;
    error_log  /var/log/nginx/ error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;

    location ~ /\.(?!well-known).* {
        deny all;

include forge-conf/*;

Actually, I just realised after setting the DNS entries to :grey: they are now behaving as expected. But switching back to Proxied :orange: seems to break it again…or is this down to caching etc?

Turns out this was a combination of server cache, incorrect setup (whereby I had broken the SSL Certificates).

So, I fixed the certificate, cleared cache, waited for 30 mins and tried again, and all is good.

This topic was automatically closed after 31 days. New replies are no longer allowed.