Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Write Go lang services that you need.
Each service listens on a different port.
Set up a web server, such as nginx, and set up virtual hosts that forward requests to Go lang services.
The nginx config will look something like this
server {
listen *:80;
server_name yourdomain1.com; # домен, который вам нужно
...
location / {
proxy_pass http://127.0.0.1:9000; # IP адрес и порт, на котором слушает сервис Go lang.
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
server {
listen *:80;
server_name yourdomain2.com; # домен, который вам нужно
...
location / {
proxy_pass http://127.0.0.1:9001; # IP адрес и порт, на котором слушает сервис Go lang.
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
How to run several web scripts on 1 hosting, on different subdomains?You just run it and it works. It is possible without containers at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question