[{"data":1,"prerenderedAt":117},["ShallowReactive",2],{"seo-verification":3,"blog-deployer-golang-vps-en":6},{"google":4,"bing":5},"EycwPY2XMyTkVzas3n1ygeNJFGAH513qrMjfDljzsMQ","",{"id":7,"slug":8,"title":9,"excerpt":10,"readTime":11,"views":12,"isPinned":13,"publishedAt":14,"category":15,"categories":21,"featuredImage":23,"bgImage":24,"posterImage":25,"relatedSolution":26,"intro":28,"sections":29,"ctaTitle":72,"ctaBody":73,"ctaButton":74,"ctaUrl":75,"relatedPosts":76},51,"deployer-golang-vps","Deploying a Go (Gin) application on a VPS","Deploy a Go (Gin) API on a Cloud VPS: static binary, Docker scratch, reverse proxy and SSL. A tutorial for Go developers.",7,287,false,"2026-04-30T00:00:00+00:00",{"id":16,"name":17,"slug":18,"color":19,"icon":20},4,"Development","developpement","bg-warning\u002F10 text-warning","dev",[22],{"id":16,"name":17,"slug":18,"color":19,"icon":20},null,"\u002Fblog\u002Fcovers\u002Fbg.svg","\u002Fblog\u002Fcovers\u002Fdeployer-golang-vps-poster.svg",{"categorySlug":18,"appSlug":27},"golang","Go compiles into a single static binary with no dependencies: it's the ideal language for self-hosting. A Gin API fits in a few megabytes of RAM and starts instantly. Here is how to put it into production on a VPS, from the binary to the SSL certificate.",[30,34,44,47,69],{"type":31,"title":32,"body":33},"h2","Why self-host a Go API on a VPS","Unlike Java or Node, a Go application (with the Gin framework) compiles into a single static binary that needs neither an interpreter, nor a runtime, nor a shared library. You can literally drop the binary onto a VPS and run it. This lightness changes everything for self-hosting: a Gin API runs in 15 to 30 MB of RAM, handles thousands of requests per second on a single core, and starts in a few milliseconds. On a VPS, you make the most of this efficiency: an entry-level server is enough to serve a load that interpreted languages would require a much bigger machine for. You also avoid the complexity of bulky Docker images: a 10 MB `scratch` image is enough.",{"type":35,"title":36,"items":37},"ul","Concrete benefits",[38,39,40,41,42,43],"Single static binary: no runtime to install, deployment by a simple file copy","Tiny memory footprint (15-30 MB) allowing you to saturate a small VPS with requests","`scratch` or `distroless` Docker image of 10-15 MB: near-instant builds and pulls","Startup in milliseconds: redeployments and restarts with no perceptible interruption","Native concurrency via goroutines: a single vCPU handles thousands of simultaneous connections","Reduced attack surface: no interpreter or system packages to patch",{"type":31,"title":45,"body":46},"Hardware and software prerequisites","This is where Go shines: a Gin API without a database fits on a VPS with 1 vCPU and 1 GB of RAM, and stays at ease. With co-located PostgreSQL, aim for 2 GB to be comfortable. You don't even need Go on the server if you compile in CI or by local cross-compilation (`GOOS=linux GOARCH=amd64 go build`). Install Docker if you containerize, or nothing at all if you launch the binary directly under systemd. Point an `api.mydomain.com` domain at the VPS IP via an A record. 5 GB of disk is more than enough.",{"type":48,"title":49,"steps":50},"steps","Step-by-step deployment",[51,54,57,60,63,66],{"title":52,"body":53},"Cross-compile the binary for Linux","From your workstation, run `CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o app .`. The `CGO_ENABLED=0` flag guarantees a 100% static binary, indispensable for a `scratch` image. You get an `app` executable ready to run on any Linux.",{"title":55,"body":56},"Build a minimal Docker image","Write a multi-stage Dockerfile: a `golang:1.22-alpine` stage to compile, then `FROM scratch` which copies only the binary and the CA certificates (`COPY --from=builder \u002Fetc\u002Fssl\u002Fcerts ...`). The final image weighs about ten MB. Expose port 8080.",{"title":58,"body":59},"Configure Gin for production","Switch Gin to release mode with `gin.SetMode(gin.ReleaseMode)` or the `GIN_MODE=release` variable to disable the verbose debug logs. Read the port and the secrets from the environment (`os.Getenv`), never hard-coded in the code.",{"title":61,"body":62},"Launch the container","Start with `docker run -d --restart unless-stopped -p 127.0.0.1:8080:8080 -e GIN_MODE=release monapp:latest`. By binding on `127.0.0.1`, you expose Gin only to the local reverse proxy, not directly to the Internet.",{"title":64,"body":65},"Place Nginx or Caddy in front","Configure a reverse proxy to `http:\u002F\u002F127.0.0.1:8080`. Caddy is particularly well suited here: with a simple `reverse_proxy localhost:8080` directive, it automatically provisions the HTTPS certificate without Certbot.",{"title":67,"body":68},"Secure with TLS","With Caddy, HTTPS is automatic as soon as the domain points to the VPS. With Nginx, run `certbot --nginx -d api.mydomain.com`. Then check the TLS chain with `curl -I https:\u002F\u002Fapi.mydomain.com`.",{"type":70,"body":71},"tip","Enable Go's `pprof` profiling behind a protected endpoint: `import _ \"net\u002Fhttp\u002Fpprof\"` exposed on an internal port only accessible via an SSH tunnel. You get CPU and memory flame graphs in real production without noticeable overhead. Also consider compiling with `-ldflags=\"-s -w\"` to reduce the binary size by 30% by removing the debug tables.","Run your Go API on an efficient VPS","The ServOrbit Cloud VPS offers dedicated cores and a high-performance network: exactly what's needed to leverage the lightness of a Go binary and serve heavy traffic on modest resources.","Discover the Cloud VPS","\u002Fvps-cloud",[77,90,104],{"id":78,"slug":79,"title":80,"excerpt":81,"readTime":11,"views":82,"isPinned":13,"publishedAt":83,"category":84,"categories":85,"featuredImage":23,"bgImage":24,"posterImage":87,"relatedSolution":88},5,"deployer-laravel-vps","Deploying Laravel on a VPS: a production guide","Take Laravel to production on a VPS: PHP, workers, cache, database, reverse proxy and HTTPS configured cleanly.",2840,"2026-02-09T00:00:00+00:00",{"id":16,"name":17,"slug":18,"color":19,"icon":20},[86],{"id":16,"name":17,"slug":18,"color":19,"icon":20},"\u002Fblog\u002Fcovers\u002Fdeployer-laravel-vps-poster.svg",{"categorySlug":20,"appSlug":89},"laravel-stack",{"id":91,"slug":92,"title":93,"excerpt":94,"readTime":95,"views":96,"isPinned":13,"publishedAt":97,"category":98,"categories":99,"featuredImage":23,"bgImage":24,"posterImage":101,"relatedSolution":102},43,"deployer-nodejs-vps","Deploy a Node.js Application on a VPS","Deploy a Node.js application to production on a VPS: PM2, Nginx reverse proxy, Let's Encrypt SSL, and automatic startup at boot.",8,591,"2026-05-08T00:00:00+00:00",{"id":16,"name":17,"slug":18,"color":19,"icon":20},[100],{"id":16,"name":17,"slug":18,"color":19,"icon":20},"\u002Fblog\u002Fcovers\u002Fdeployer-nodejs-vps-poster.svg",{"categorySlug":18,"appSlug":103},"nodejs",{"id":105,"slug":106,"title":107,"excerpt":108,"readTime":95,"views":109,"isPinned":13,"publishedAt":110,"category":111,"categories":112,"featuredImage":23,"bgImage":24,"posterImage":114,"relatedSolution":115},44,"deployer-django-vps","Deploy a Django Application on a VPS","Deploy Django on a VPS: Gunicorn, Nginx, PostgreSQL, Docker, and SSL. A complete guide for Python developers who want to self-host.",628,"2026-05-07T00:00:00+00:00",{"id":16,"name":17,"slug":18,"color":19,"icon":20},[113],{"id":16,"name":17,"slug":18,"color":19,"icon":20},"\u002Fblog\u002Fcovers\u002Fdeployer-django-vps-poster.svg",{"categorySlug":18,"appSlug":116},"django",1785628429744]