[{"data":1,"prerenderedAt":124},["ShallowReactive",2],{"seo-verification":3,"blog-deploying-a-spring-boot-application-on-a-vps-en":6},{"google":4,"bing":5},"EycwPY2XMyTkVzas3n1ygeNJFGAH513qrMjfDljzsMQ","",{"id":7,"slug":8,"slugs":9,"title":12,"excerpt":13,"readTime":14,"views":15,"isPinned":16,"publishedAt":17,"category":18,"categories":24,"featuredImage":26,"bgImage":27,"posterImage":28,"relatedSolution":26,"intro":29,"sections":30,"ctaTitle":73,"ctaBody":74,"ctaButton":75,"ctaUrl":76,"relatedPosts":77},50,"deploying-a-spring-boot-application-on-a-vps",{"fr":10,"en":8,"ar":11},"deployer-spring-boot-vps","نشر-تطبيق-spring-boot-على-خادم-vps","Deploying a Spring Boot application on a VPS","Deploy a Spring Boot application on a Cloud VPS with Docker, an executable JAR, Nginx and SSL. A complete guide for Java developers.",3,0,false,"2026-05-01T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},4,"Development","developpement","bg-warning\u002F10 text-warning","dev",[25],{"id":19,"name":20,"slug":21,"color":22,"icon":23},null,"\u002Fblog\u002Fcovers\u002Fbg.svg","\u002Fblog\u002Fcovers\u002Fdeployer-spring-boot-vps-poster.svg","Spring Boot remains the standard for enterprise Java APIs and microservices. Rather than paying for a PaaS billed by JVM memory, a VPS gives you full control over the heap, the connection pool and the monthly cost. Here is how to deploy your artifact cleanly in production.",[31,35,45,48,70],{"type":32,"title":33,"body":34},"h2","Why self-host Spring Boot on a VPS","A Spring Boot application embeds its own server (Tomcat or Undertow) and ships as a standalone executable JAR. This is ideal for a VPS: a single `app.jar` file, one JVM, and you're running. PaaS platforms like Heroku or managed containers bill for every 512 MB slice of RAM, yet the JVM is greedy at startup. On a VPS, you set `-Xmx` yourself, you share the PostgreSQL database and the API on the same machine, and you control the cold warm-up without an imposed timeout. You also keep control over the exact JDK version (Temurin 21 LTS, GraalVM) and over the GC parameters, which is rarely possible in a managed environment.",{"type":36,"title":37,"items":38},"ul","Concrete benefits",[39,40,41,42,43,44],"Full control of the JVM heap (`-Xmx`, `-Xms`) and the garbage collector according to your real load","PostgreSQL database and API co-located: no public network hop between the app and the data","Fixed and predictable monthly cost, with no billing per RAM slice or compute time","JDK freedom: Temurin 21 LTS, GraalVM native-image or Azul Zulu according to your needs","No imposed cold start: your service stays warm 24\u002F7 for stable response times","Actuator, Micrometer and Prometheus exposed freely for fine-grained monitoring at no extra cost",{"type":32,"title":46,"body":47},"Hardware and software prerequisites","A Spring Boot API with a database runs comfortably on a VPS with 2 vCPU and 4 GB of RAM (count 1 to 1.5 GB for the JVM, the rest for PostgreSQL and the system). For a lightweight microservice without a heavy ORM, 2 GB is enough but stays tight at startup. Install Docker and Docker Compose, a JDK 21 if you compile on the server (otherwise build the JAR in CI and send only the artifact), and point a domain name such as `api.mydomain.com` at the VPS IP via an A record. Plan for 10 GB of disk minimum for the Docker images and logs.",{"type":49,"title":50,"steps":51},"steps","Step-by-step deployment",[52,55,58,61,64,67],{"title":53,"body":54},"Build the executable JAR","Run `.\u002Fmvnw clean package -DskipTests` (or `.\u002Fgradlew bootJar`). You get a file in `target\u002Fapp.jar` that embeds Tomcat and all the dependencies. Check locally with `java -jar target\u002Fapp.jar` before any upload.",{"title":56,"body":57},"Containerize with a multi-stage Dockerfile","Use `eclipse-temurin:21-jre-alpine` as the final image and copy only the JAR. A multi-stage build (`maven:3.9-eclipse-temurin-21` to compile, JRE to run) reduces the image from 700 MB to about 250 MB. Expose port 8080.",{"title":59,"body":60},"Orchestrate app + PostgreSQL with Docker Compose","Declare two services in `docker-compose.yml`: `app` and `db` (image `postgres:16`). Pass the credentials via environment variables (`SPRING_DATASOURCE_URL`, `SPRING_DATASOURCE_USERNAME`) and link them through an internal network. Run `docker compose up -d`.",{"title":62,"body":63},"Configure Nginx as a reverse proxy","Install Nginx and create a vhost that does a `proxy_pass http:\u002F\u002F127.0.0.1:8080;`. Add the `X-Forwarded-For` and `X-Forwarded-Proto` headers so that Spring correctly detects HTTPS behind the proxy (`server.forward-headers-strategy=framework`).",{"title":65,"body":66},"Enable HTTPS with Certbot","Run `certbot --nginx -d api.mydomain.com` to obtain and install a Let's Encrypt certificate. Automatic renewal is handled by Certbot's systemd timer. Force the HTTP-to-HTTPS redirect in the vhost.",{"title":68,"body":69},"Make restart reliable","Add `restart: unless-stopped` to your Compose services and configure the Actuator healthcheck (`\u002Factuator\u002Fhealth`) as the Docker probe. This way the app restarts on its own after a VPS reboot or a JVM crash.",{"type":71,"body":72},"tip","Compile your application into a native image with GraalVM (`.\u002Fmvnw -Pnative native:compile` via Spring Boot 3): the binary starts in under 100 ms and consumes 3 to 5 times less RAM than a classic JVM. This is decisive on a small VPS where every hundred MB counts. Also limit the heap explicitly with `JAVA_OPTS=-Xmx512m` in Compose to prevent the JVM from claiming all the available memory.","Deploy your Spring Boot API in minutes","The ServOrbit Cloud VPS provides a ready-to-use Docker environment, with dedicated resources and a fixed IP, to run your Spring Boot JAR in production without tedious system configuration.","Discover the Cloud VPS","\u002Fvps-cloud",[78,93,109],{"id":79,"slug":80,"slugs":81,"title":84,"excerpt":85,"readTime":19,"views":15,"isPinned":16,"publishedAt":86,"category":87,"categories":88,"featuredImage":26,"bgImage":27,"posterImage":90,"relatedSolution":91},5,"deploying-laravel-on-a-vps-a-production-guide",{"fr":82,"en":80,"ar":83},"deployer-laravel-vps","نشر-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.","2026-02-09T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},[89],{"id":19,"name":20,"slug":21,"color":22,"icon":23},"\u002Fblog\u002Fcovers\u002Fdeployer-laravel-vps-poster.svg",{"categorySlug":23,"appSlug":92},"laravel-stack",{"id":94,"slug":95,"slugs":96,"title":99,"excerpt":100,"readTime":14,"views":15,"isPinned":16,"publishedAt":101,"category":102,"categories":103,"featuredImage":26,"bgImage":27,"posterImage":105,"relatedSolution":106},43,"deploy-a-nodejs-application-on-a-vps",{"fr":97,"en":95,"ar":98},"deployer-nodejs-vps","نشر-تطبيق-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.","2026-05-08T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},[104],{"id":19,"name":20,"slug":21,"color":22,"icon":23},"\u002Fblog\u002Fcovers\u002Fdeployer-nodejs-vps-poster.svg",{"categorySlug":107,"appSlug":108},"development","nodejs-stack",{"id":110,"slug":111,"slugs":112,"title":115,"excerpt":116,"readTime":14,"views":15,"isPinned":16,"publishedAt":117,"category":118,"categories":119,"featuredImage":26,"bgImage":27,"posterImage":121,"relatedSolution":122},44,"deploy-a-django-application-on-a-vps",{"fr":113,"en":111,"ar":114},"deployer-django-vps","نشر-تطبيق-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.","2026-05-07T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},[120],{"id":19,"name":20,"slug":21,"color":22,"icon":23},"\u002Fblog\u002Fcovers\u002Fdeployer-django-vps-poster.svg",{"categorySlug":107,"appSlug":123},"django",1787580996514]