2

I'm trying configure a sub-subdomain on Nginx running on Ubuntu. I already have a configuration to access http://staging.mydomain.com and it works fine but now I need to access this URL http://api.staging.mydomain.com.

I tried this but without success:

upstream myapp {
    server unix:/var/tmp/myapp.sock;
}

upstream myapp_api {
    server unix:/var/tmp/myapp_api.sock;
}

# Configuration to subdomain
server {
    listen 80 default_server;
    server_name staging.mydomain.com;

    location / {
        root /var/www/myapp/current/public;

        if (!-f $request_filename) {
            proxy_pass http://myapp;
            break;
        }
    }
}

# Configuration to sub-subdomain
server {
    listen 80;
    server_name api.staging.mydomain.com;

    location / {
        root /var/www/api_myapp/current/public;

        if (!-f $request_filename) {
            proxy_pass http://api_myapp;
            break;
        }
    }
}

With this configuration I received this error:

The server at api.staging.mydomain.com can't be found, because the DNS lookup failed.

Any ideas? Thank you.

1 Answer 1

4

The server at api.staging.example.com can't be found, because the DNS lookup failed.

You need to create a DNS CNAME or A record for this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .