www pointing to an ip and any subdomain to another ip

Asked

Viewed 3,071 times

0

I have an application that works with DNS wildcard. So any subdomain is valid. For example:

test.dominio.com.br other domain.com.br

Any of the above links go to a particular IP.

I happen to want to create a wordpress site for this application of mine and it will work in the URL www.dominio.com.br

Currently my DNS settings are like this:

Type A with name @ pointing to IP X
Type A with name * pointing to IP X

So I’m thinking about creating another DNS entry like this:

Type A with name www pointing to IP Y.

In my application when the person enters without for anything, only the domain.com.br my application redirects to www.dominio.com.br

I wonder if this is the best way and if I won’t make it all stop working if I do as I thought.

2 answers

1

In the DNS zone would look like this:

seudominio.ficticio     IN     A        1.2.3.4
*                       IN     A        2.2.3.4
www                     IN     CNAME    seudominio.ficticio

*I’m not considering how is the SOA and other parameters, but this is the general scope.

To redirect without www. to www., it is recommended to do outside the DNS zone because within the DNS zone you can point everything to www., which would make the emails look like @www.seudominio.ficticio.

For redirect, apply to webserver resources (Nginx, apache, iis, etc).

Example, for Apache, mod_rewrite.

0

I’ve done something similar using the Nginx, you can configure as subdminios or even in a single url, passing parameters.

Exemplo:
   www.meusistema.com.br/cliente1 = 192.168.1.1
   www.meusistema.com.br/cliente2 = 192.168.1.5

Here is the documentation http://nginx.org/en/docs/http/server_names.html Nginx’s how to set up multiple Servers with different ips, so you can play with the rules or by subdomain as already said.

In this case your Nginx would be your IP Y, receives all requests and directs to the correct server doing the proxy service.

I found this article with something a little bit like deploy-de-various-applications-no-Nginx-Passenger-using-subdomain-or-suburi.

Example of file I use Nginx.conf

http {
    include       mime.types;
    default_type  application/octet-stream;
    server_names_hash_bucket_size  64;

    sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  0;

    gzip  on;

    server {
        listen       80;
        server_name  teste.meudominio.com;
        location / {
        proxy_pass http://intancia1:8090/;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
    }
    }

    server {
        listen       80;
        server_name  producao.meudominio.com;
        location / {
        proxy_pass http://instancia0:8080/;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
    }

    #aqui vou adicionando quantos eu precisar e aponto para as maquinas que preciso

    }

}

Can do the test will not regret super simple to set up.

I hope I’ve helped.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.