GoG homepage > (your name [drop down menu] when logged in) > “Games” > Click on any game in your collection > Download offline backup game installers
You can download installers for whatever systems the game supports – usually that’s just a Windows .EXE installer (+ several .bin files if the game is large). For games intended to run on Linux w/o WINE, you can select “Linux” from a drop down where it says system and it will give you an .sh file.
You can do this by configuring an HTTP server (e.g. Apache) to listen on port 80 and/or 443 (HTTP and HTTPS standard ports, respectively) and select which site to serve based on the name of the site requested. Apache documentation for this feature is here: https://httpd.apache.org/docs/2.4/vhosts/name-based.html
Note the sample config snippet showing how to set up a simple static site serving both
www.example.com
andother.example.com
usingServerName
in aVirtualHost
to select between them.You can also have Apache match a pattern in the URL and reverse proxy to another HTTP server – that can just be another program on the same computer listening on a different port, or could be on another computer entirely. See the simple reverse proxy config example on this page for a starting point: https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html (Note also that you probably don’t need anything further down that page – e.g. the load balancer and failover stuff is not likely to be useful to you for a small personal project.)
Other popular HTTP servers can do this too; I just happen to have done it with Apache before.