<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nwoke Jideofor Justice</title>
    <description>The latest articles on DEV Community by Nwoke Jideofor Justice (@unclejide1).</description>
    <link>https://dev.to/unclejide1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F310607%2F2012f728-afd0-4bff-8461-7d3d52888956.jpeg</url>
      <title>DEV Community: Nwoke Jideofor Justice</title>
      <link>https://dev.to/unclejide1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/unclejide1"/>
    <language>en</language>
    <item>
      <title>How to Set Up a Subdomain with Nginx and SSL on DigitalOcean</title>
      <dc:creator>Nwoke Jideofor Justice</dc:creator>
      <pubDate>Wed, 26 Feb 2025 14:08:07 +0000</pubDate>
      <link>https://dev.to/unclejide1/how-to-set-up-a-subdomain-with-nginx-and-ssl-on-digitalocean-fg0</link>
      <guid>https://dev.to/unclejide1/how-to-set-up-a-subdomain-with-nginx-and-ssl-on-digitalocean-fg0</guid>
      <description>&lt;p&gt;A few weeks ago, while working on a Java Spring Boot application—let’s call it a simple "Hello World" application—I successfully deployed it to a DigitalOcean droplet. However, I ran into a problem when trying to connect it to a domain and secure the URL for the front end to consume. I couldn’t find a resource that explicitly guided me through the entire process, so I had to figure it out by researching and troubleshooting.&lt;/p&gt;

&lt;p&gt;I've always been passionate about contributing to the tech community, and this article is my way of sharing what I've learned. Before diving in, it's beneficial to have a basic understanding of deploying to a &lt;a href="https://cloud.digitalocean.com/" rel="noopener noreferrer"&gt;DigitalOcean &lt;/a&gt; droplet, whether through a CI/CD pipeline or manually uploading your JAR files and running the app on the server. In this guide, I’ll walk you through setting up &lt;a href="https://nginx.org/" rel="noopener noreferrer"&gt;Nginx&lt;/a&gt;, and &lt;a href="https://certbot.eff.org/" rel="noopener noreferrer"&gt;Certbot&lt;/a&gt;, and securing your domain with SSL using &lt;a href="https://account.godaddy.com/products" rel="noopener noreferrer"&gt;Godaddy &lt;/a&gt; as the domain provider&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before getting into it, ensure you have the following prerequisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic knowledge of the command line&lt;/li&gt;
&lt;li&gt;A &lt;a href="https://cloud.digitalocean.com/" rel="noopener noreferrer"&gt;DigitalOcean &lt;/a&gt; droplet with a public IP address.&lt;/li&gt;
&lt;li&gt;A domain name registered with &lt;a href="https://account.godaddy.com/products" rel="noopener noreferrer"&gt;Godaddy &lt;/a&gt; (or any other registrar).&lt;/li&gt;
&lt;li&gt;SSH access to your droplet.&lt;/li&gt;
&lt;li&gt;A deployed Java Spring Boot application running on your droplet.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Configuring an A Record
&lt;/h2&gt;

&lt;p&gt;Before proceeding, verify that your Java application is successfully deployed and running on your droplet. Since you're already familiar with the deployment process, ensure your application is accessible and operating as expected. Once you’ve confirmed everything is in place, you can proceed to the next step.&lt;/p&gt;

&lt;p&gt;With your droplet set up, let's connect your domain to it by configuring an A Record to point your domain name directly to your Droplet's IP address. Here’s a step-by-step process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Start by logging into your GoDaddy account. Once you're in, locate the My Account tab in the top left corner. Click on it, and then select "Domains" to navigate to your domain management page, where you can adjust your settings as needed.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh7-rt.googleusercontent.com%2Fdocsz%2FAD_4nXdLX_ok042o-drq30J-AfoJaBGrhMTDveCXv1XYjBmp5I5lTryFTSN1CXmJhu4pYaardkrEW7CW_Jxrn32MuhilC2Bjna9tQgAeuekjqqZVSrIeczDGMWgBsRPvlW1Hkqg126ChUA%3Fkey%3D0AgOhfOsUkbNegfo4Wse0-_I" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh7-rt.googleusercontent.com%2Fdocsz%2FAD_4nXdLX_ok042o-drq30J-AfoJaBGrhMTDveCXv1XYjBmp5I5lTryFTSN1CXmJhu4pYaardkrEW7CW_Jxrn32MuhilC2Bjna9tQgAeuekjqqZVSrIeczDGMWgBsRPvlW1Hkqg126ChUA%3Fkey%3D0AgOhfOsUkbNegfo4Wse0-_I" alt="Select “My Account”" width="800" height="364"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once you’ve logged in and navigated to your list of domains, click on the domain you want to connect to your app. Next, head over to the "DNS" tab. For clarity, DNS (Domain Name System) is a key component of the internet that converts user-friendly domain names (like &lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt;) into numerical IP addresses (like 93.184.216.34), which computers use to communicate with each other. This is where you’ll manage the settings to link your domain to your droplet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now that you're in the DNS settings for your domain, it's time to add an A Record to point your domain to your DigitalOcean Droplet's IPv4 address. An A Record (Address Record) maps a domain name to its corresponding IPv4 address. Follow these steps:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Locate the Option to Add a New Record: Find and click the option to add a new DNS record, as shown below.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter the Record Details: Fill in the fields with the following information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Host, @: This symbol represents your root domain.&lt;/li&gt;
&lt;li&gt;Value: Enter your DigitalOcean Droplet's public IP address.&lt;/li&gt;
&lt;li&gt;TTL: Set it to Automatic (This allows the system to manage your time-to-live settings.)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Save the Record: Once you've entered all the details, save your new A Record.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh7-rt.googleusercontent.com%2Fdocsz%2FAD_4nXeVUvlJB2Efw_kH92LmL2JApaDnMcDKHmZxepDCiNEjE9LEpp-IYqHJcVIDRxQuxUc4EsRpSY-QHiain4WuxDKVw0PfZmupky5aml-VCql8tsx9tuROQO8YGrEJ_7PTtBQ6EMt6oQ%3Fkey%3D0AgOhfOsUkbNegfo4Wse0-_I" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh7-rt.googleusercontent.com%2Fdocsz%2FAD_4nXeVUvlJB2Efw_kH92LmL2JApaDnMcDKHmZxepDCiNEjE9LEpp-IYqHJcVIDRxQuxUc4EsRpSY-QHiain4WuxDKVw0PfZmupky5aml-VCql8tsx9tuROQO8YGrEJ_7PTtBQ6EMt6oQ%3Fkey%3D0AgOhfOsUkbNegfo4Wse0-_I" alt="Save the Record" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you'd like your site to be accessible via &lt;a href="http://www.yourdomain.com" rel="noopener noreferrer"&gt;www.yourdomain.com&lt;/a&gt;, you can add A Record. This ensures that both the root domain and the www subdomain point to your DigitalOcean Droplet. To do this, set it up like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Host: www&lt;/li&gt;
&lt;li&gt;Value: Your DigitalOcean Droplet's public IP address.&lt;/li&gt;
&lt;li&gt;TTL: Automatic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you add this record, visitors can access your site using either your root domain or the www subdomain. Also, DNS changes can take up to 24 hours to propagate. Use tools like &lt;a href="https://dnschecker.org/" rel="noopener noreferrer"&gt;DNS Checker&lt;/a&gt;  to verify the changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Nginx on Your Droplet
&lt;/h2&gt;

&lt;p&gt;Before we dive into installing Nginx, it's essential to understand why you're doing this. Nginx is a high-performance web server and reverse proxy server. In this setup, you'll use Nginx for several key reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reverse Proxy&lt;/strong&gt;: Nginx will forward incoming HTTP/HTTPS requests to your Java application running on the droplet. This helps manage and balance the load, ensuring smooth and efficient handling of web traffic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Static Content Serving&lt;/strong&gt;: If your application includes static files (like images, CSS, or JavaScript), Nginx can serve these directly, often improving performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security &amp;amp; SSL Termination&lt;/strong&gt;: Nginx can handle SSL/TLS encryption, providing an additional layer of security for your site by managing HTTPS connections.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance &amp;amp; Scalability&lt;/strong&gt;: Nginx efficiently handles concurrent connections, enhancing your application's ability to scale and perform under heavy traffic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that you understand why Nginx is essential to your setup let's install it on your droplet.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Install Nginx
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Update Your Package List: Open your terminal and run the following command to ensure your package list is up to date: &lt;code&gt;sudo apt update&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Install Nginx by running &lt;code&gt;sudo apt install nginx&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;After installation, ensure that Nginx is running and set to start on boot. Use these commands &lt;code&gt;sudo systemctl start nginx&lt;/code&gt; and &lt;code&gt;sudo systemctl enable nginx&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Allow HTTP and HTTPS traffic through the firewall. To do that, run these commands -  &lt;code&gt;sudo ufw allow 'Nginx Full'&lt;/code&gt; and &lt;code&gt;sudo ufw enable&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then, open a web browser and enter your droplet's public IP address. You should see the default Nginx welcome page, indicating the installation succeeded.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With Nginx installed, you're ready to configure it to work as a reverse proxy for your Java application and further enhance your server's performance and security. In this step, you'll create a configuration file for prod.swidexpay.com to achieve the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTTP to HTTPS Redirection&lt;/strong&gt;: All HTTP requests (port 80) will be automatically redirected to HTTPS (port 443) for secure communication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure HTTPS Handling&lt;/strong&gt;: Nginx will listen on port 443 and use SSL certificates (from Let's Encrypt) to establish a secure connection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reverse Proxy Setup&lt;/strong&gt;: Incoming HTTPS requests will be forwarded to your Java application running on your droplet at &lt;a href="http://127.0.0.1:8080" rel="noopener noreferrer"&gt;http://127.0.0.1:8080&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, we’ll need to configure Nginx. Follow these instructions to do so:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create a New Configuration File&lt;/strong&gt;: Open your terminal and create a new file for your subdomain:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;sudo&lt;/span&gt; &lt;span class="nx"&gt;nano&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;nginx&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;sites&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;available&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;prod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;swidexpay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Insert the configuration below into the file&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;server_name&lt;/span&gt; &lt;span class="nx"&gt;prod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;swidexpay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nx"&gt;Redirect&lt;/span&gt; &lt;span class="nx"&gt;HTTP&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;HTTPS&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;301&lt;/span&gt; &lt;span class="nx"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//$host$request_uri;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="nx"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;server_name&lt;/span&gt; &lt;span class="nx"&gt;prod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;swidexpay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;ssl_certificate&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;letsencrypt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;live&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;prod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;swidexpay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;fullchain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;ssl_certificate_key&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;letsencrypt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;live&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;prod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;swidexpay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;privkey&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;include&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;letsencrypt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;ssl&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;nginx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;conf&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;location&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;proxy_pass&lt;/span&gt; &lt;span class="na"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//127.0.0.1:8080;&lt;/span&gt;
            &lt;span class="nx"&gt;proxy_http_version&lt;/span&gt; &lt;span class="mf"&gt;1.1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nx"&gt;proxy_set_header&lt;/span&gt; &lt;span class="nx"&gt;Upgrade&lt;/span&gt; &lt;span class="nx"&gt;$http_upgrade&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nx"&gt;proxy_set_header&lt;/span&gt; &lt;span class="nx"&gt;Connection&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;upgrade&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nx"&gt;proxy_set_header&lt;/span&gt; &lt;span class="nx"&gt;Host&lt;/span&gt; &lt;span class="nx"&gt;$host&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nx"&gt;proxy_cache_bypass&lt;/span&gt; &lt;span class="nx"&gt;$http_upgrade&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- **HTTP Block (Port 80)**: This block listens for HTTP requests and redirects them to HTTPS.
- **HTTPS Block (Port 443)**: This block manages secure connections using SSL and configures a reverse proxy that forwards requests to your application on port 8080.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Create a symbolic link to enable the configuration:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;sudo&lt;/span&gt; &lt;span class="nx"&gt;ln&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;nginx&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;sites&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;available&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;prod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;swidexpay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;com&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;nginx&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;sites&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;enabled&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Test your configuration for any syntax errors:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;sudo&lt;/span&gt; &lt;span class="nx"&gt;nginx&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the test passes, reload Nginx to apply your changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;sudo&lt;/span&gt; &lt;span class="nx"&gt;systemctl&lt;/span&gt; &lt;span class="nx"&gt;reload&lt;/span&gt; &lt;span class="nx"&gt;nginx&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After completing these steps, your subdomain prod.swidexpay.com is now configured to securely handle incoming traffic by redirecting HTTP requests to HTTPS and proxying them to your Java application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Secure the server connections with SSL certificates
&lt;/h2&gt;

&lt;p&gt;Great job configuring Nginx for your subdomain! Now that your server handles HTTP-to-HTTPS redirection and proxies requests to your Java application, the next step is to secure these connections using SSL certificates. We'll now move on to installing Certbot and configuring SSL certificates from &lt;a href="https://letsencrypt.org/" rel="noopener noreferrer"&gt;Let's Encrypt&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, install Certbot along with its Nginx plugin by running the following.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;sudo&lt;/span&gt; &lt;span class="nx"&gt;apt&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="nx"&gt;certbot&lt;/span&gt; &lt;span class="nx"&gt;python3&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;certbot&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;nginx&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Use Certbot to obtain and configure an SSL certificate for your subdomain automatically.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;sudo&lt;/span&gt; &lt;span class="nx"&gt;certbot&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;nginx&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;d&lt;/span&gt; &lt;span class="nx"&gt;prod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;swidexpay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Finally, test the automatic renewal process to ensure your SSL certificate will be renewed without issues.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;sudo&lt;/span&gt; &lt;span class="nx"&gt;certbot&lt;/span&gt; &lt;span class="nx"&gt;renew&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;dry&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;run&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Completing these steps ensures that your subdomain prod.swidexpay.com is secured with a valid SSL certificate, providing encrypted connections for your users. &lt;/p&gt;

&lt;p&gt;It is important to ensure that your DNS settings correctly direct traffic to your desired endpoints. In this next step, we'll update your DNS settings so that visitors using your development subdomain's "www" prefix are seamlessly directed to the correct domain.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Log In to Your GoDaddy Account&lt;/strong&gt;: Access your GoDaddy account and navigate to the DNS management tab.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configure a new CNAME record with the following details&lt;/strong&gt;:&lt;/li&gt;
&lt;li&gt;Host: &lt;a href="http://www.prod" rel="noopener noreferrer"&gt;www.prod&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Value: prod.swidexpay.com&lt;/li&gt;
&lt;li&gt;TTL: Automatic&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Congratulations! You’ve successfully set up a subdomain, configured Nginx, and secured it with SSL on your DigitalOcean droplet. Your subdomain is now ready to serve traffic securely over HTTPS. If you encounter any issues, refer to the official documentation for Nginx and Certbot.&lt;br&gt;
This guide saves you the time and effort I spent figuring things out. Feel free to share it with others who might benefit from it if you find it helpful. Happy coding!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
