[{"data":1,"prerenderedAt":139},["ShallowReactive",2],{"seo-verification":3,"blog-deploying-a-spring-boot-application-on-a-vps-ma-en":6,"promo-bar-likely":138},{"google":4,"bing":5},"EycwPY2XMyTkVzas3n1ygeNJFGAH513qrMjfDljzsMQ","",{"key":7,"data":8},"blog-deploying-a-spring-boot-application-on-a-vps-ma-en",{"id":9,"slug":10,"slugs":11,"title":15,"excerpt":16,"readTime":17,"views":18,"isPinned":19,"noindex":19,"publishedAt":20,"updatedAt":21,"category":22,"categories":27,"featuredImage":29,"bgImage":30,"posterImage":31,"relatedSolution":32,"intro":35,"sections":36,"ctaTitle":79,"ctaBody":80,"ctaButton":81,"ctaUrl":82,"relatedPosts":83},50,"deploying-a-spring-boot-application-on-a-vps",{"fr":12,"en":10,"ar":13,"es":14},"deployer-spring-boot-vps","نشر-تطبيق-spring-boot-على-خادم-vps","desplegar-spring-boot-en-un-vps","Deploying a Spring Boot application on a VPS","Deploy a Spring Boot application on a Cloud VPS: fat JAR, systemd service, Nginx and SSL, with OpenJDK 21 and PostgreSQL 16. A complete guide for Java developers.",4,2,false,"2026-05-01T00:00:00+00:00","2026-11-04T16:30:25+00:00",{"id":17,"name":23,"slug":24,"color":25,"icon":26},"Development","developpement","bg-warning\u002F10 text-warning","dev",[28],{"id":17,"name":23,"slug":24,"color":25,"icon":26},null,"\u002Fblog\u002Fcovers\u002Fbg.svg","\u002Fblog\u002Fcovers\u002Fdeployer-spring-boot-vps-poster.svg",{"categorySlug":33,"appSlug":34},"development","spring-boot-stack","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.",[37,41,51,54,73,76],{"type":38,"title":39,"body":40},"h2","Why Self-Host Spring Boot on a VPS?","Managed Java platforms bill per RAM slice and lock you into their JDK version, which complicates JVM tuning and PostgreSQL connection management. On a VPS, you control the full stack: OpenJDK 21 LTS with Virtual Threads, Maven for builds, Nginx at the front, and PostgreSQL 16 for data. You decide on JVM flags, connection pool size, and deployment strategy. For a production Spring Boot application, this transparency is decisive: you can profile a slow endpoint, adjust `-Xmx` per service, and deploy a new version with no hidden extra cost.",{"type":42,"title":43,"items":44},"ul","Concrete Benefits of a Self-Hosted Spring Boot",[45,46,47,48,49,50],"Full control over PostgreSQL: indexes, VACUUM, connection pools, and scheduled pg_dump backups.","Virtual Threads (OpenJDK 21 Loom) for Spring WebMVC: hundreds of concurrent requests without reactive rewrites.","Fixed, predictable cost regardless of traffic or API request volume.","Data and logs under your jurisdiction, useful for compliance and auditing.","Freedom of JDK version and system dependencies without buildpack constraints.","Reproducible deployments: one fat JAR, one `java -jar`, and the application is live.",{"type":38,"title":52,"body":53},"Hardware and Software Requirements","For a Spring Boot application with PostgreSQL, plan at least 2 vCPU and 2 GB RAM; target 4 GB if you run multiple services or a loaded connection pool. The recommended OS is Ubuntu 24.04 LTS — OpenJDK 21 is in the official repositories, no PPA required. A domain name is optional: without one, an SSH tunnel to port 8080 suffices for development and testing. Allocate at least 10 GB of disk for the JVM, application, database, and logs.",{"type":55,"title":56,"steps":57},"steps","Deploy Spring Boot Step by Step",[58,61,64,67,70],{"title":59,"body":60},"Install OpenJDK 21 and PostgreSQL","SSH into your VPS and run `apt-get install -y openjdk-21-jdk maven nginx postgresql postgresql-contrib` — no extra repository setup on Ubuntu 24.04. ⚠️ Name `openjdk-21-jdk` explicitly: the `maven` package only depends on `default-jre-headless`, that is `openjdk-21-jre-headless`, a runtime with no `javac`. This is why `java -version` does print 21.x and makes everything look ready, while the first build on the server fails with `No compiler is provided in this environment`. Verify: `javac -version`, `mvn -version` and `psql --version` (16.x).",{"title":62,"body":63},"Create the PostgreSQL Database and User","Connect as `sudo -u postgres psql` and run `CREATE USER myapp WITH PASSWORD 'StrongPassword'; CREATE DATABASE myappdb OWNER myapp;`. Set `spring.datasource.url=jdbc:postgresql:\u002F\u002Flocalhost\u002Fmyappdb` in your `application.properties`.",{"title":65,"body":66},"Build and Upload the JAR","Run `mvn clean package -DskipTests` locally, then transfer the fat JAR to `\u002Fvar\u002Fwww\u002Fyour-app\u002Fapp.jar` via `scp`. Create an `application.properties` with your PostgreSQL credentials and `server.port=8080`.",{"title":68,"body":69},"Create a systemd Service","Create `\u002Fetc\u002Fsystemd\u002Fsystem\u002Fyour-app.service` with `ExecStart=\u002Fusr\u002Fbin\u002Fjava -jar \u002Fvar\u002Fwww\u002Fyour-app\u002Fapp.jar`, `Restart=always`, `User=www-data`. Run `systemctl daemon-reload && systemctl enable --now your-app`. Check with `systemctl status your-app` and `journalctl -u your-app -f`.",{"title":71,"body":72},"Configure Nginx and Enable HTTPS","Create an Nginx server block with `proxy_pass http:\u002F\u002F127.0.0.1:8080;` and `X-Forwarded-Proto` headers. Run `certbot --nginx -d your-domain.com` for a free Let's Encrypt certificate. Spring Boot listens on the internal port only; Nginx handles TLS.",{"type":74,"body":75},"tip","Use Java 21 Virtual Threads with Spring MVC to multiply throughput without switching to WebFlux: add `spring.threads.virtual.enabled=true` to your `application.properties`. Each HTTP request runs in a lightweight virtual thread — thousands can be active simultaneously without saturating the system thread pool. ⚠️ The gain stays conditional on OpenJDK 21: a virtual thread that blocks inside a `synchronized` block pins its carrier thread instead of releasing it, and that limit is only lifted by JEP 491, in JDK 24. So before expecting a gain on I\u002FO-bound workloads (SQL calls, REST) on a 2 GB VPS, check that your JDBC driver has moved to `ReentrantLock` — the PostgreSQL one did so starting with 42.6.0 — and measure pinning with the `jdk.VirtualThreadPinned` JFR event instead of assuming it.",{"type":38,"title":77,"body":78},"Deploy Spring Boot in One Click from the ServOrbit Marketplace","The ServOrbit Marketplace offers a preconfigured Spring Boot Stack template: OpenJDK 21 LTS, Maven, Nginx, and PostgreSQL 16 are installed automatically on your VPS at order time. No SSH session for the base setup — you arrive directly at the step of uploading your JAR. The marketplace listing contains exact specifications, use cases, and a first-configuration guide.","Deploy Your Spring Boot Stack in Minutes","The ServOrbit Spring Boot Stack template installs OpenJDK 21 LTS, Maven, Nginx, and PostgreSQL 16 on your VPS. Upload your JAR and start immediately.","Deploy Spring Boot Stack","\u002Fapplications\u002Fdevelopment\u002Fspring-boot-stack",[84,102,120],{"id":85,"slug":86,"slugs":87,"title":91,"excerpt":92,"readTime":17,"views":93,"isPinned":19,"noindex":19,"publishedAt":94,"updatedAt":95,"category":96,"categories":97,"featuredImage":29,"bgImage":30,"posterImage":99,"relatedSolution":100},5,"deploying-laravel-on-a-vps-a-production-guide",{"fr":88,"en":86,"ar":89,"es":90},"deployer-laravel-vps","نشر-laravel-على-خادم-vps-دليل-الإنتاج","desplegar-laravel-en-un-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.",1,"2026-02-09T00:00:00+00:00","2026-09-07T11:26:10+00:00",{"id":17,"name":23,"slug":24,"color":25,"icon":26},[98],{"id":17,"name":23,"slug":24,"color":25,"icon":26},"\u002Fblog\u002Fcovers\u002Fdeployer-laravel-vps-poster.svg",{"categorySlug":26,"appSlug":101},"laravel-stack",{"id":103,"slug":104,"slugs":105,"title":109,"excerpt":110,"readTime":111,"views":93,"isPinned":19,"noindex":19,"publishedAt":112,"updatedAt":113,"category":114,"categories":115,"featuredImage":29,"bgImage":30,"posterImage":117,"relatedSolution":118},43,"deploy-a-nodejs-application-on-a-vps",{"fr":106,"en":104,"ar":107,"es":108},"deployer-nodejs-vps","نشر-تطبيق-nodejs-على-vps","desplegar-una-aplicacion-nodejs-en-un-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,"2026-05-08T00:00:00+00:00","2026-11-08T01:13:12+00:00",{"id":17,"name":23,"slug":24,"color":25,"icon":26},[116],{"id":17,"name":23,"slug":24,"color":25,"icon":26},"\u002Fblog\u002Fcovers\u002Fdeployer-nodejs-vps-poster.svg",{"categorySlug":33,"appSlug":119},"nodejs-stack",{"id":121,"slug":122,"slugs":123,"title":127,"excerpt":128,"readTime":129,"views":130,"isPinned":19,"noindex":19,"publishedAt":131,"updatedAt":21,"category":132,"categories":133,"featuredImage":29,"bgImage":30,"posterImage":135,"relatedSolution":136},44,"deploy-a-django-application-on-a-vps",{"fr":124,"en":122,"ar":125,"es":126},"deployer-django-vps","نشر-تطبيق-django-على-vps","desplegar-una-aplicacion-django-en-un-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.",3,7,"2026-05-07T00:00:00+00:00",{"id":17,"name":23,"slug":24,"color":25,"icon":26},[134],{"id":17,"name":23,"slug":24,"color":25,"icon":26},"\u002Fblog\u002Fcovers\u002Fdeployer-django-vps-poster.svg",{"categorySlug":33,"appSlug":137},"django",true,1794270389287]