[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"global-header-tutorials-static":3,"article-setting-nginx-ssl-for-spring-boot-application":4,"initial-similar-fetch":21},[],{"alias":5,"title":6,"description":7,"content":8,"thumbnail":9,"keywords":10,"categories":15,"tags":19,"createdAt":20},"setting-nginx-ssl-for-spring-boot-application","Setup Nginx and SSL for Spring Boot Application","Setting Nginx as a reverse proxy in our Spring Boot application","{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"In this tutorial, we are going to set up Nginx for our Spring Boot application.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":2},\"content\":[{\"type\":\"text\",\"text\":\"Prerequisites\"}]},{\"type\":\"bulletList\",\"content\":[{\"type\":\"listItem\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"A Linux\u002FUbuntu server \"}]}]},{\"type\":\"listItem\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Deployed a Spring Boot application. Here is a detailed tutorial on \"},{\"type\":\"text\",\"marks\":[{\"type\":\"link\",\"attrs\":{\"href\":\"https:\u002F\u002Fcsbyte.com\u002Fblog\u002Fdeploy-spring-boot-application-with-docker\",\"target\":\"_blank\",\"rel\":\"noopener noreferrer nofollow\",\"class\":null,\"title\":null}}],\"text\":\"Deploy Spring Boot Application with Docker on Ubuntu Server \"}]}]},{\"type\":\"listItem\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"A domain name points to the Ubuntu server's public IP address.\"}]}]}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":2},\"content\":[{\"type\":\"text\",\"text\":\"Install and Configure Nginx\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"First, install Nginx for reverse proxy setup\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"sudo apt update\\nsudo apt install nginx\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"If you open your public IP address or domain URL with port 8080, you can see the nginx landing page.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":2},\"content\":[{\"type\":\"text\",\"text\":\"Create the Reverse Proxy Config\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Create a file for Nginx Configuration:\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"sudo vi \u002Fetc\u002Fnginx\u002Fsites-available\u002Fmyapp\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Give your domain name instead of myapp. Add the following configuration in your file:\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"server {\\n    listen 80;\\n    server_name api.example.com www.api.example.com;\\n\\n    location \u002F {\\n        proxy_pass http:\u002F\u002Flocalhost:8080;\\n        proxy_set_header Host $host;\\n        proxy_set_header X-Real-IP $remote_addr;\\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\\n        proxy_set_header X-Forwarded-Proto $scheme;\\n    }\\n}\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Here, \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"proxy_pass\"},{\"type\":\"text\",\"text\":\" will forward every request from your domain \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"api.example.com\"},{\"type\":\"text\",\"text\":\" to your running Spring Boot application.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Enable the Configuration\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Use the following command to enable our configuration file:\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"sudo ln -s \u002Fetc\u002Fnginx\u002Fsites-available\u002Fmyapp \u002Fetc\u002Fnginx\u002Fsites-enabled\u002F\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Check the syntax error\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"sudo nginx -t\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"This must result in the successful output:\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"nginx: the configuration file \u002Fetc\u002Fnginx\u002Fnginx.conf syntax is ok\\nnginx: configuration file \u002Fetc\u002Fnginx\u002Fnginx.conf test is successful\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Reload Nginx\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"sudo systemctl restart nginx\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"You can see the status of your running nginx as:\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"sudo systemctl restart nginx\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"The output will look like this:\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"● nginx.service - A high performance web server and a reverse proxy server\\n     Loaded: loaded (\u002Fusr\u002Flib\u002Fsystemd\u002Fsystem\u002Fnginx.service; enabled; preset: enabled)\\n     Active: active (running) since Sun 2026-05-03 09:56:51 UTC; 21h ago\\n       Docs: man:nginx(8)\\n   \"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":2},\"content\":[{\"type\":\"text\",\"text\":\"Set Up SSL with Let's Encrypt\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Now lets setup HTTPs for our Spring Boot application. We are using certbot to manage this.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Install Certbot\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":null},\"content\":[{\"type\":\"text\",\"text\":\"sudo apt install python3-certbot-nginx\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Obtain and Install Certificate\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"sudo certbot --nginx -d yourdomain.com\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"This will create the SSL certificate and update your nginx config file. The sample updated config file looks like this: You can verify with \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"sudo vi \u002Fetc\u002Fnginx\u002Fsites-available\u002Fmyapp\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"    listen 443 ssl; # managed by Certbot\\n    ssl_certificate \u002Fetc\u002Fletsencrypt\u002Flive\u002Fyour-domain.com\u002Ffullchain.pem; # managed by Certbot\\n    ssl_certificate_key \u002Fetc\u002Fletsencrypt\u002Flive\u002Fyour-domain.com\u002Fprivkey.pem; # managed by Certbot\\n    include \u002Fetc\u002Fletsencrypt\u002Foptions-ssl-nginx.conf; # managed by Certbot\\n    ssl_dhparam \u002Fetc\u002Fletsencrypt\u002Fssl-dhparams.pem; # managed by Certbot\\n\\n}\\nserver {\\n    if ($host = your-domain.com) {\\n        return 301 https:\u002F\u002F$host$request_uri;\\n    } # managed by Certbot\\n\\n\\n    listen 80;\\n    server_name your-domain.com;\\n    return 404; # managed by Certbot\\n\\n\\n}\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Now reload the Nginx.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":2},\"content\":[{\"type\":\"text\",\"text\":\"Handle CORS in Spring Boot\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"You might get a CORS issue if you have a different domain that wants to communicate with your Spring Boot app. We need to set up and handle the CORS. Add the following config to your Spring application.\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"@Configuration\\npublic class WebConfig implements WebMvcConfigurer {\\n\\n    @Override\\n    public void addCorsMappings(CorsRegistry registry) {\\n        registry.addMapping(\\\"\u002F**\\\")\\n                .allowedOrigins(\\\"https:\u002F\u002Fyour-frontend-doamin.com\\\", \\\"https:\u002F\u002Fwww.your-frontend-doamin.com\\\")\\n                .allowedMethods(\\\"GET\\\", \\\"POST\\\", \\\"PUT\\\", \\\"DELETE\\\", \\\"OPTIONS\\\")\\n                .allowedHeaders(\\\"*\\\")\\n                .allowCredentials(true);\\n    }\\n}\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"We have configured Nginx and installed SSL for HTTPS.\"}]}]}","\u002Fuploads\u002Fthumbnails\u002F5433c987-9e86-4d90-9cce-a831d1598ba4_spring-boot-nginx.png",[11,12,13,14],"spring-boot","spring","deploy","nginx",[16,17,18],"Deployment","Spring Framework","Spring Boot",[12,11],"2026-05-04T05:36:23.075Z",[22,29,35,41,47,53,59,65,71,77,82,88,94,100,106,112],{"alias":23,"title":24,"description":25,"thumbnail":26,"createdAt":27,"tutorialAlias":28,"lessonAlias":28},"springdoc-openapi-swagger-ui-in-spring","Implementing springdoc-openapi swagger ui in Spring Boot application","Adding springdoc-openapi swagger ui in a Spring Boot application","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F3501ace5-c9b0-4819-8d35-d8714390c075_swagger_product_highlighted.png","2026-06-30T10:39:32.703Z",null,{"alias":30,"title":31,"description":32,"thumbnail":33,"createdAt":34,"tutorialAlias":28,"lessonAlias":28},"spring-boot-multi-stage-build-with-docker","Creating spring boot multi-stage build with docker","How to create a Spring Boot multi-stage build with Docker","\u002Fuploads\u002Fthumbnails\u002F8931e2f7-a669-4fbb-855b-5ebe396f462e_multi-stage-build-docke.jpeg","2026-06-20T06:34:41.356Z",{"alias":36,"title":37,"description":38,"thumbnail":39,"createdAt":40,"tutorialAlias":28,"lessonAlias":28},"configure-profile-in-spring-boot","Configure different spring profiles in spring boot application","Managing Spring Boot profiles for different environments along with Docker","\u002Fuploads\u002Fthumbnails\u002F59a52e59-4b56-469d-8902-41af5e0f13dd_Spring-profil.jpeg","2026-06-20T04:51:27.098Z",{"alias":42,"title":43,"description":44,"thumbnail":45,"createdAt":46,"tutorialAlias":28,"lessonAlias":28},"global-exception-handling-in-spring-boot","Implementing Robust Global Exception Handling in Spring Boot","How to Handle Errors in Spring Boot: An Architectural Guide","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F554489e1-d142-4ea5-a393-994a13d7b113_exception-handling.png","2026-06-12T17:15:16.253Z",{"alias":48,"title":49,"description":50,"thumbnail":51,"createdAt":52,"tutorialAlias":28,"lessonAlias":28},"spring-boot-create-libraries-gradle","Building Reusable Spring Boot Libraries with Gradle","Architectural Guide: Building Reusable Spring Boot Libraries with Gradle","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002Ff4fb088d-1018-4d2b-ae6c-cdd5d0fd60ae_spring-Initializr.png","2026-06-12T15:55:20.994Z",{"alias":54,"title":55,"description":56,"thumbnail":57,"createdAt":58,"tutorialAlias":28,"lessonAlias":28},"multi-build-project-gradle-spring-boot","Setting up a multi-project build in Gradle for Spring Boot","How to set up a multi-project build in Gradle for Spring Boot","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002Fd43933e4-a7a3-404b-a300-8f02db98f549_multi-build-project.png","2026-06-12T04:15:23.045Z",{"alias":60,"title":61,"description":62,"thumbnail":63,"createdAt":64,"tutorialAlias":28,"lessonAlias":28},"java-version-mismatch-gradle","Java Version Mismatch for Gradle Build","How to Fix Gradle Error: Dependency requires at least JVM runtime version 17. This build uses a Java 8 JVM","\u002Fuploads\u002Fthumbnails\u002Fa4c6c910-5623-4db9-93f5-a515135adb99_gradle_version_mismatc.jpeg","2026-06-09T12:15:21.729Z",{"alias":66,"title":67,"description":68,"thumbnail":69,"createdAt":70,"tutorialAlias":28,"lessonAlias":28},"constructor-confusion-in-spring","Constructor Confusion in Spring Framework","Constructor Confusion and how to handle it in Spring Framework","\u002Fuploads\u002Fthumbnails\u002Fd0f09fc0-e1f9-49d1-bf9a-7d1c41050196_di_confusio.jpeg","2026-05-21T14:13:31.437Z",{"alias":72,"title":73,"description":74,"thumbnail":75,"createdAt":76,"tutorialAlias":28,"lessonAlias":28},"dependency-pull-lookup-spring","Dependency Pull and Contextualized Dependency Lookup in Spring Framework","Dependency Pull and Contextualized Dependency Lookup IoC Types in Spring Framework","\u002Fuploads\u002Fthumbnails\u002Fd1132443-313b-4dce-b713-55f356ef6051_depndency_pull.png","2026-05-20T15:26:06.494Z",{"alias":78,"title":79,"description":79,"thumbnail":80,"createdAt":81,"tutorialAlias":28,"lessonAlias":28},"types-of-dependency-injection-spring","Types of Dependency Injection in Spring Framework","\u002Fuploads\u002Fthumbnails\u002Fafb32399-6dda-41c4-b07c-7decb8257bbb_di_constructor_sette.jpeg","2026-05-19T17:01:51.972Z",{"alias":83,"title":84,"description":85,"thumbnail":86,"createdAt":87,"tutorialAlias":28,"lessonAlias":28},"spring-framework-project-for-gradle-with-intellij-idea","How to create a clean Spring Framework project for Gradle with IntelliJ IDEA","Create a clean Spring Framework project for Gradle with IntelliJ IDEA","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F0e4abad5-17e2-4311-8cf0-7d8f67af975a_spring-framework.png","2026-05-19T10:28:20.866Z",{"alias":89,"title":90,"description":91,"thumbnail":92,"createdAt":93,"tutorialAlias":28,"lessonAlias":28},"spring-dependency-injection-and-inversion-control","Dependency Injection (DI) and Inversion of Control (IoC) in Spring","Mastering Dependency Injection (DI) and Inversion of Control (IoC) in Spring: A Practical Guide for Building a Notification System","\u002Fuploads\u002Fthumbnails\u002F53c64b94-f188-40b4-9ae9-ad97612d688b_spring_d.jpeg","2026-05-19T05:31:45.138Z",{"alias":95,"title":96,"description":97,"thumbnail":98,"createdAt":99,"tutorialAlias":28,"lessonAlias":28},"deploy-spring-boot-application-with-docker","Deploy Spring Boot Application with Docker on Ubuntu Server","The ultimate guide to deploying our Spring Boot application with Docker on an Ubuntu server","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F55a11844-d1e9-4e83-80e5-c6bb6df7d58b_intellij-idea-build.png","2026-05-03T05:58:55.642Z",{"alias":101,"title":102,"description":103,"thumbnail":104,"createdAt":105,"tutorialAlias":28,"lessonAlias":28},"how-to-install-and-setup-the-docker-on-ubuntu","How to install and setup the docker on Ubuntu","Setting up Docker in Ubuntu Linux","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F6c8baf8b-90b9-486c-8a92-56621ea6a234_show_container.png","2026-05-02T12:15:48.659Z",{"alias":107,"title":108,"description":109,"thumbnail":110,"createdAt":111,"tutorialAlias":28,"lessonAlias":28},"how-to-deploy-nuxt-app-in-ubuntu-server","How to deploy Nuxt app in Ubuntu Server","Deploy Nuxt App in Linux VM","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F808571e8-1ce9-4e1b-901f-7afd81f4c7df_pm2.png","2026-05-02T08:11:55.437Z",{"alias":113,"title":114,"description":115,"thumbnail":116,"createdAt":117,"tutorialAlias":28,"lessonAlias":28},"how-to-deploy-our-nuxt-application-to-cloudflare","How to deploy our nuxt application to cloudflare","Deploy our Nuxt application to Cloudflare using Wrangler","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F19c8ef54-4006-4bfa-a07d-b2dd5e401c22_nuxt_deploy.png","2026-05-02T02:23:45.510Z"]