M
M
Michail Wowtschuk2017-02-07 13:15:12
go
Michail Wowtschuk, 2017-02-07 13:15:12

How to implement the processing of the main site and subdomains on the same server on GO?

There is a site with subdomains, the site runs its own service, each subdomain has its own, everything is written in PHP, and it all runs on one server.
I want to rewrite everything on GO, but I have no idea how everything works in it.
Therefore, the questions arose:
How to make sure that each service has its own executable GO file?
Or is it easier to place each service on a new server?
What is the best way to set this up?
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Pavlyuk, 2017-02-07
@pav5000

Install nginx, which will accept user requests and scatter them among host services depending on the domain.

U
uvelichitel, 2017-02-07
@uvelichitel

A single Go binary can easily listen on multiple network addresses and dispatch multiple URIs. A request handler is just a function with a specific signature. A dispatcher is an object that registers handlers by address.
If you definitely want a separate binary for each service, then put nginx as a reverse proxy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question