G
G
greck102014-06-25 00:11:17
linux
greck10, 2014-06-25 00:11:17

Development of a SAAS service. How to connect a 2nd level domain?

Hello.
I am developing a SAAS service for creating online stores.
After registration, clients receive a third-level domain (company-client.saassite.ru) and place goods/services. All stores share a common database.
The system prototype uses mod_rewrite to determine the requested page, thus: the company-client.saassite.ru/about address actually calls the dir.php ?site=company-client.saassite.ru&page=about script, which collects the required page. Everything works for third-level domains.
Question - how to make the ability to connect second-level domains?
It is clear that DNS needs to be registered on these domains, something like: dns.saassite.ru
But I don’t know how to set up the server so that the request company-client.ru/about (dns.saassite.ru) executes the dir.php?site=company-client.ru&page=about script and which would return the page. I'm not strong in setting up servers, but I need to at least understand the essence of solving the problem.
And in general, is the right path chosen in terms of server load? How do smart people do such things?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-06-25
Protko @Fesor

Yes, you need to raise your DNS server available on the dns.saassite.ru domains, which then the end user will have to register for his domain. The DNS server will contain all the main records (A and MX records, as I understand it) and they will point to your service as well as saassite.ru.
Then we simply at the server level (by the way, apache2 is not needed) simply, when a request arrives, we determine what they want from us by the domain name. This is already a trivial task, the link was given to you. That is, there are difficulties only in setting up your own DNS server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question