<?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: Qowiyyu Adelaja</title>
    <description>The latest articles on DEV Community by Qowiyyu Adelaja (@qowiyyu_adelaja).</description>
    <link>https://dev.to/qowiyyu_adelaja</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%2F1497609%2F21fb2ad8-10a6-4edc-9066-5aebb572e3cb.jpg</url>
      <title>DEV Community: Qowiyyu Adelaja</title>
      <link>https://dev.to/qowiyyu_adelaja</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/qowiyyu_adelaja"/>
    <language>en</language>
    <item>
      <title>Installing NGINX on GCP (Google Cloud Platform)</title>
      <dc:creator>Qowiyyu Adelaja</dc:creator>
      <pubDate>Fri, 07 Feb 2025 07:45:13 +0000</pubDate>
      <link>https://dev.to/qowiyyu_adelaja/installing-nginx-on-gcp-google-cloud-platform-13i</link>
      <guid>https://dev.to/qowiyyu_adelaja/installing-nginx-on-gcp-google-cloud-platform-13i</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I have always wanted to expand my skills from backend to cloud computing and DevOps. Knowing the nitty-gritty of how the infrastructure that facilitates software deployment has always fascinated me; hence, I joined the HNG internship.&lt;/p&gt;

&lt;p&gt;As a finalist of HNG 10 when my focus was on becoming a finalist, this time I want to have fun and make a lot of techie friends while picking up DevOps skills and becoming a finalist.&lt;/p&gt;

&lt;p&gt;The first task was setting up and configuring NGINX on a fresh Ubuntu server with the default HTML page overridden, so I decided to explore Google Cloud Platform (GCP) by creating a virtual machine (VM). Here's how I did it, the challenges I faced, and how this boosted my confidence in using GCP.&lt;/p&gt;

&lt;h2&gt;
  
  
  Task Overview
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create a VM on GCP.&lt;/li&gt;
&lt;li&gt;SSH into the VM using gcloud.&lt;/li&gt;
&lt;li&gt;Install nginx on the VM&lt;/li&gt;
&lt;li&gt;Configure the firewall to accept HTTP and HTTPS.&lt;/li&gt;
&lt;li&gt;Change the default html page.&lt;/li&gt;
&lt;li&gt;Restart nginx.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Create a VM on GCP
&lt;/h2&gt;

&lt;p&gt;I created a Google cloud account and logged into the Google cloud console &lt;a href="https://cloud.google.com/" rel="noopener noreferrer"&gt;Google cloud console&lt;/a&gt;. &lt;br&gt;
On creating the account, press the &lt;em&gt;Create a VM&lt;/em&gt; &amp;gt; &lt;em&gt;Enable Compute Engine API&lt;/em&gt; &amp;gt; &lt;em&gt;Create VM Instances&lt;/em&gt;. Configure the VM instance with the settings below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Name&lt;/strong&gt;: simple-nginx-configuration&lt;br&gt;
&lt;strong&gt;Region/Zone&lt;/strong&gt;: europe-west1-d&lt;br&gt;
&lt;strong&gt;Machine Type&lt;/strong&gt;: e2-micro (free tier)&lt;br&gt;
&lt;strong&gt;Boot Disk&lt;/strong&gt;: Ubuntu 20.04 LTS&lt;br&gt;
&lt;strong&gt;Firewall&lt;/strong&gt;: Enabled HTTP and HTTPS traffic&lt;/p&gt;
&lt;h2&gt;
  
  
  2. SSH into the VM
&lt;/h2&gt;

&lt;p&gt;To SSH into the VM, download the gcloud tool using the &lt;a href="https://cloud.google.com/sdk/docs/install" rel="noopener noreferrer"&gt;official guide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then I authenticated using&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gcloud auth login&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Then I configured the project ID&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gcloud config set project [project_id]&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;NB: Replace the project_id with your project_id&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then I SSH into the VM using&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gcloud compute ssh [INSTANCE_NAME] --zone [zone]&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Install nginx on the VM
&lt;/h2&gt;

&lt;p&gt;Update the package list&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update

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

&lt;/div&gt;



&lt;p&gt;Install nginx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install nginx

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

&lt;/div&gt;



&lt;p&gt;Verify the installation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nginx -v

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

&lt;/div&gt;



&lt;p&gt;Start nginx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl start nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable nginx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check nginx status&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl status nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NB: &lt;em&gt;You will see &lt;strong&gt;running&lt;/strong&gt; if the service is active/started&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Configure the Firewall
&lt;/h2&gt;

&lt;p&gt;Enable the firewall&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo ufw enable&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Allow HTTP&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo ufw allow 'Nginx HTTP'&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Allow HTTPS&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo ufw allow 'Nginx HTTPS'&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Allow SSH&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo ufw allow 'OpenSSH'&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Verify firewal rules&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo ufw status&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Change Default HTML Page
&lt;/h2&gt;

&lt;p&gt;Open the html page using vi or nano (I used nano), edit and save it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /var/www/html/index.html
&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;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Welcome&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Welcome&amp;lt;/h1&amp;gt;
    &amp;lt;p&amp;gt;Welcome to DevOps Stage 0 - [Your Name]/[SlackName]&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ensured the file has the correct permission&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chown -R www-data:www:data /var/www/html
sudo chmod -R 755 /var/www/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Restart nginx
&lt;/h2&gt;

&lt;p&gt;Restart nginx to reflect the changes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl restart nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the webpage in a browser using &lt;code&gt;http://[your ip address]&lt;/code&gt;. You should see content of the html page&lt;/p&gt;

&lt;h2&gt;
  
  
  How This Task Contributes to My Learning and Professional Goals
&lt;/h2&gt;

&lt;p&gt;This task was a hands-on experience that deepened my understanding of creating and managing VM instances on GCP and configuring a web server(nginx).&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;Here are some roles that HNG can provide engineers for:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://hng.tech/hire/devops-engineers" rel="noopener noreferrer"&gt;DevOps Engineers&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hng.tech/hire/cloud-engineers%20" rel="noopener noreferrer"&gt;Cloud Engineers&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hng.tech/hire/site-reliability-engineers%20" rel="noopener noreferrer"&gt;Site Reliability Engineers&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hng.tech/hire/platform-engineers%20" rel="noopener noreferrer"&gt;Platform Engineers&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hng.tech/hire/infrastructure-engineers%20" rel="noopener noreferrer"&gt;Infrastructure Engineers&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hng.tech/hire/kubernetes-specialists%20" rel="noopener noreferrer"&gt;Kubernetes Specialists&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hng.tech/hire/ci-cd-pipeline-engineers%20" rel="noopener noreferrer"&gt;CI/CD Pipeline Engineers&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hng.tech/hire/monitoring-observability-engineers%20" rel="noopener noreferrer"&gt;Monitoring/Observability Engineers&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hng.tech/hire/docker-specialists%20" rel="noopener noreferrer"&gt;Docker Specialists&lt;/a&gt;&lt;/p&gt;

</description>
      <category>googlecloud</category>
      <category>nginx</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
