How to redirect a subdomain using the DNS service of Registro.br

1

I have a private server with fixed IP and I have some sites running on port 80.

Configuration: Linux Debian and Apache

For example, I have two subdomains:

IP_SERVIDOR/site1
IP_SERVIDOR/site2

I registered the two domains in the registry.br: "www.site1.com.br" and "www.site2.com.br".

I am using the DNS services of the own registry.br. I would like to know how to use the DNS zone editing to redirect each subdomain. That is:

www.site1.com.br -> IP_SERVIDOR/site1
www.site2.com.br -> IP_SERVIDOR/site2

The most I can do is to set type "A" in the DNS zone edit in the .br registry.

Para o site1
www.site1.com.br    A    IP_SERVIDOR

Para o site2
www.site2.com.br    A    IP_SERVIDOR

That is, both sites will point to the root. In my case they will fall into the root of the www folder. I believe the rest of the configuration would be on the Apache server.

Could anyone help me?

    
asked by anonymous 30.04.2015 / 16:50

1 answer

2

This involves changing the web server settings that you use. In case of Apache, it's VirtualHosts.

Here is a link to the apache website, with instructions on how to proceed: link

In DNS configuration you only need one line, which associates the domain name with IP, type A. The rest can be all configured on your server, from HTTP to email and other applications.

For virtualhosts, you need to create / edit the apache configuration file that has these settings, and put anything like this (not tested):

<VirtualHost *:80>
DocumentRoot /www/site1
ServerName www.site1.com.br
# Other directives here
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /www/site2
ServerName www.site2.com.br
# Other directives here
</VirtualHost>

Never forget security mechanisms when accessing files and other things to keep in mind when configuring a folder to serve as a root to a site. The fact that in the examples a line says "# Other directives here" is why they should be!

    
30.04.2015 / 17:04