<?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: Aruzhan Abduvali</title>
    <description>The latest articles on DEV Community by Aruzhan Abduvali (@riimoon).</description>
    <link>https://dev.to/riimoon</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%2F1251884%2F281781d7-b5b2-4f93-9516-350f2bf157e2.jpeg</url>
      <title>DEV Community: Aruzhan Abduvali</title>
      <link>https://dev.to/riimoon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/riimoon"/>
    <language>en</language>
    <item>
      <title>Setting up Nginx as a Reverse Proxy for Jenkins with SSL certificates on multiple subdomains using Certbot on Ubuntu 20.04</title>
      <dc:creator>Aruzhan Abduvali</dc:creator>
      <pubDate>Mon, 08 Jan 2024 20:12:17 +0000</pubDate>
      <link>https://dev.to/riimoon/setting-up-nginx-as-a-reverse-proxy-for-jenkins-with-ssl-certificates-on-multiple-subdomains-using-certbot-on-ubuntu-2004-4p6n</link>
      <guid>https://dev.to/riimoon/setting-up-nginx-as-a-reverse-proxy-for-jenkins-with-ssl-certificates-on-multiple-subdomains-using-certbot-on-ubuntu-2004-4p6n</guid>
      <description>&lt;p&gt;&lt;strong&gt;Step 1: Install the Nginx Web Server&lt;/strong&gt;&lt;br&gt;
Ubuntu&lt;br&gt;
&lt;code&gt;sudo apt update&lt;br&gt;
sudo apt install nginx vim&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Note: Ensure that Apache2 is not running simultaneously with Nginx. If Apache2 is running, stop and disable it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Configure Nginx for the Jenkins Server subdirectory&lt;/strong&gt;&lt;br&gt;
After installing Nginx web server, create a VirtualHost configuration file:&lt;br&gt;
&lt;code&gt;sudo vim /etc/nginx/conf.d/jenkins.conf&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Paste and modify the following configurations in the created file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;upstream jenkins {
  server 127.0.0.1:8080 fail_timeout=0;
}

server {
  listen 80;
  server_name jenkins.example.com;

  location / {
    proxy_set_header        Host $host:$server_port;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto $scheme;
    proxy_pass              http://jenkins;
    proxy_http_version 1.1;
    proxy_request_buffering off;
    proxy_buffering off;
  }
}

server {
  listen 80;
  server_name www.jenkins.example.com;

  location / {
    proxy_set_header        Host $host:$server_port;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto $scheme;
    proxy_pass              http://jenkins;
    proxy_http_version 1.1;
    proxy_request_buffering off;
    proxy_buffering off;
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace:&lt;br&gt;
jenkins.example.com and &lt;a href="http://www.jenkins.example.com"&gt;www.jenkins.example.com&lt;/a&gt; with your Jenkins server domain name as configured in the DNS server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Validate Nginx configuration&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;sudo nginx -t&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Output should confirm that the syntax is OK and the test is successful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Start Nginx service&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;sudo systemctl enable --now nginx&lt;br&gt;
sudo systemctl restart nginx&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Nginx is now configured to proxy requests to the Jenkins server. Access Jenkins using your specified domain name (e.g., jenkins.example.com or &lt;a href="http://www.jenkins.example.com"&gt;www.jenkins.example.com&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Certbot instructions - Nginx on Ubuntu 20&lt;br&gt;
Step 1: SSH into the Server&lt;/strong&gt;&lt;br&gt;
SSH into the server running your HTTP website as a user with sudo privileges.&lt;br&gt;
&lt;code&gt;ssh your_username@your_server_ip&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Step 2: Install Snapd&lt;/strong&gt;&lt;br&gt;
Install Snapd on the server.&lt;br&gt;
&lt;code&gt;sudo apt install snapd&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Step 3: Remove Existing Certbot Packages&lt;/strong&gt;&lt;br&gt;
Remove any Certbot packages installed using the OS package manager.&lt;br&gt;
&lt;code&gt;sudo apt remove certbot&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Step 4: Install Certbot Snap&lt;/strong&gt;&lt;br&gt;
Install Certbot using Snap.&lt;br&gt;
&lt;code&gt;sudo snap install --classic certbot&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Step 5: Obtain and Install SSL Certificate&lt;/strong&gt;&lt;br&gt;
Run Certbot to get a certificate and automatically edit the Nginx configuration to enable HTTPS.&lt;br&gt;
&lt;code&gt;sudo certbot --nginx&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Follow the prompts to enter your email address and answer other questions.&lt;/p&gt;

&lt;p&gt;Choose which domain you want to activate HTTPS or press Enter to choose everything.&lt;br&gt;
You can check your SSL certificate's expiration date and other information on the &lt;a href="https://www.ssllabs.com/"&gt;SSL Server Test (Powered by Qualys SSL Labs) &lt;/a&gt;website.&lt;/p&gt;

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