V
V
Viktor2015-10-16 01:17:57
linux
Viktor, 2015-10-16 01:17:57

So how is it right to attach domains and subdomains to hosting, what is the most correct way?

Hello, please give the newbie the right education and the rules of good taste in matters of linking a domain / and its subdomains with hosting.

As I understand it, there are two ways, by
writing NS records (as here https://www.reg.ru/support/hosting-i-servery/sajty... )

Or simply by adding A-records with the IP address of the server in the domain, like in the instructions here support.2domains.ru/knowledgebase.php?article=66 . Somehow, from the very beginning, I use this particular method, as advised in the article,
i.e. I add three A-records to the domain with the address of the hosting server, like:
@
www
*

And everything seems to be working, and no dns servers need to be registered.
I just recently noticed that with such a config on Apache hosting, incredible things happen, for example, any subdomain of the site.ru site (absolutely any, you can guess, for example, sub1.site.ru) will display the contents of the site.ru site, although I configs did not touch and did not change. And for example, a domain that is simply linked to the server through the A records described above, but does not have a host record and directory created for it, will display the contents of another neighboring site on the hosting at its address. Tin in general.

Please tell me, as it is right, according to the Orthodox, everything should be done? And how then to send subdomains of the main domain to hosting, so that everything is displayed correctly and correctly and only where necessary?

Answer the question

In order to leave comments, you need to log in

8 answer(s)
R
Ruslan Fedoseev, 2015-10-16
@victafonenko

Both options are correct.
Concerning misunderstandings in the second variant. Well, you yourself indicated that * - i.e. all subdomains link to your site. And then everything happens as you set it up:
for Apache:

<VirtualHost a.b.c.d:80>
ServerName site.ru
ServerAlias www.site.ru *.site.ru
...
</VirtualHost>

In this option, you specified that the main name of the site is site.ru, but in addition to it, accept requests for www.site.ru and *.site.ru. Frankly, www.site.ru is redundant in ServerAlias.
Those. any subdomain up to kfjjvkfjvbkjbvkjbvkjvbkejbv.site.ru will lead to your virtualhost.
If *.site.ru is not specified in ServerAlias, then the following will happen. The request will come to the server, but there is no suitable virthost. Then Apache will give this request for processing either to the first virthost in the config, or to the so-called default. If the hosting admins have not configured the default virthost, it means that the site will work from this server.
Hence the conclusion - if you already specify * IN A abcd in the zone config - please configure the virtualhost correctly - either register *.site.ru in the alias, or create your own virtualhost for each subdomain you need. But this still does not free you from the need to specify *.site.ru in the alias of which thread of your virtualhost.
If you don't want this behavior, write exactly the records that you need in the dns settings. Well, make virthosts for them.
The difference between setting up NS servers and A records is simply where you will rule the domain. If you transferred the NS server of your domain to the hosting server, then the necessary entries in the DNS must be created in the hosting control panel. If only A records - then the domain management remains with the registrar, and hosting management - with the hoster.

S
Saboteur, 2015-10-16
@saboteur_kiev

what are NS records? understand the terms.
That's right - A record so that at the address mydomain.com you get to the desired server (the correct IP was determined)
The NS server in the record points to the NS servers that will respond to those who will look for mydomain.com
And the fact that you have apache on hosting is configured crookedly, that's another question. Apache supports virtual hosting, and different sites can hang on the same IP. How Apache is configured, so it will respond to sites unknown to it (give default for example)

O
Ogogon, 2015-10-16
@Ogogon

DNS always works one way. Each zone (domain) is served by at least two DNS servers. Primary (primary) stores the original file that describes the zone, the IP addresses of its machines, subdomains and other information. The secondary (secondary) server, or servers, stores the same information received from the primary. It's insurance against his failure. Ideally, all servers should have different network connections. They are all listed in the zone file as entries of type 'NS'.
DNS servers can be at the owner of the resource, they can be provided by a web host or registrar, when delegating a domain. The main thing is that they should be at least two, and with synchronous information.
You can edit the zone file and its entries both directly and through the web interface. This does not change anything.
If you create a web server, then the record about it must be in the zone of its domain, i.e. in the end, we should set its IP address. This is an 'A' record or a link to another 'A' record.
Now about the web server. Its protocol allows obtaining information about the domain name of the site being accessed.
Therefore, several different sites can be given the same IP address. This is a permitted move. The Web server will still understand which one is being accessed.
This trick is called 'name based virtual hosting' or 'virtual hosting based on domain names'.
To implement this, you need to properly configure your web server. The mentioned Apache is perfectly able to do it.
You need to study the documentation for a specific one, paying attention to setting up virtual hosting.

R
rainwall, 2012-10-30
@rainwall

If most of the English speakers - paypal

P
pomeo, 2012-10-30
@pomeo

2Checkout.com? I myself do not use it for reception, but I often meet it for payment on different sites. You can use both card and paypal. With the conclusion there, too, everything seems to be fine.

I
iNTellect, 2013-07-01
@iNTellect

Perhaps the author will no longer be relevant, but someone else may need it: www.payanyway.ru (commission for cards from 3% or less, it is possible to enable acceptance of cards from non-Russian banks as agreed)

P
Pomidorinka, 2014-03-06
@Pomidorinka

Good time of the day! I myself have almost completely switched to online payments. The most suitable site for me was www.businesskassa.com I recommend it.

N
nikolaevnakatya, 2017-07-31
@nikolaevnakatya

This will make it easier for you to compare several companies with each other and choose the right one. On this site - https://mainmine.ru/priyom-platezhej-na-saite - you can do just that. There you can compare the percentage of the commission by indicating the turnover, rubles / month and the type of your activity, then you will have a convenient list of companies that provide such services.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question