Answer the question
In order to leave comments, you need to log in
How to organize access by domain names to different projects to vps?
Hello
, I have an old macbook, building a front (webpack \ nuxt) on it, working with legacy (bitrix), with large and not optimized databases - it’s already difficult, if you shove it into the docker - it’s impossible (low speed), so I rented a vps contabo, now threw the code base there, each project in its docker (lemp stack), nginx (which is in the docker) of each project forwards its port to the outside.
those I work with project number 1 - port 1000 is there (it is hardcoded in env, I know this)
I write code on a poppy, my docker code is loaded on vps via ftp\sftp\rsync By the
way, this code is taken as volume, sometimes you have to wait a couple seconds, but this is heaven and earth when compared with docker on a poppy
, so, I wrote the code, go to the browser 194.161.162.63:1000 and see if everything works
and if I work with project No. 2 - port 1010 is there (hardly registered in env, I know this)
everything is the same, but I go to the
browser 194.161 .
, there are old projects and new ones, etc.
I don’t like to write the ip address every time, it’s much more convenient to remember the domain name (subdomain), and it’s more pleasant to show customers and colleagues when you throw a link, and not the ip address
hence the question (maybe I’m not a devops at all and I don’t understand a lot of things), how can I make sure that I have my own domain for each project?
how I see it:
1) looking for the cheapest domain
2) delegating to my hosting
3) for each project I create an additional level porjet1.domain.ru, porjet2.domain.ru ... porjetN.domain.ru (I delegate to vps (although it seems like it (dns) will look there by itself)
4) no longer in docker , but natively on vps becoming nginx
5) this native nginx listens on port 80 \ 433 and, according to the domain name, forwards (it's called proxies, right?) a request to a specific port (which is fixed and I know it for each project)
porjet1.domain.ru -> 194.161.162.63:1000
porjet2.domain.ru -> 194.161.162.63:1010
....
Will this work?
Do they do that?
This is a perversion and can it be simpler?
ps
docker is only for development, it is not on prod, code from git gets there, docker registry is not used
for me docker:
- a convenient solution for a different stack (php7.2-8.1 mysql\postgre
) their versions (prod, feature1, feature2), and on the laptop 100GB of space initially
- I use the power of the VPS, and not the laptop that barely takes out "large" projects, it gets warm and my hands are sweaty))
Answer the question
In order to leave comments, you need to log in
The direction of thought is correct, but the details are not quite.
1. Everything is so on the domain.
2. The domain must be delegated to DNS hosting. Therefore, do not buy a domain in nicru, they have become obsolete for a long time and want money for it. Buy on 2domen.ru or somewhere else, where free DNS hosting is.
3. Yes, create third-level domain names (A records) in the DNS admin panel and specify the IP address of the VPC as the destination.
4.5. It is possible in the docker, it will even be more convenient. Thus, you will specify proxy_pass by the name of the application container, otherwise you will encounter the fact that when recreating containers, you will have to change the addresses in the nginx config, i.e. porject1.domain.ru -> porject1_container_name:1000
It's not perverted at all, this is the right approach.
Previously, they gave completely free domains
www.dot.tk/en/index.html?lang=en
In addition, you can register dns entries for non-existent domains in your hosts file, in Windows itself
c:\Windows\System32\Drivers\etc\ hosts
194.161.162.63:1000 myproject1.ru
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question