<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Digital Ocean on My Notes</title><link>https://harryho.github.io/cloud/digito/</link><description>Recent content in Digital Ocean on My Notes</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://harryho.github.io/cloud/digito/index.xml" rel="self" type="application/rss+xml"/><item><title>DigitialOcean: Droplet</title><link>https://harryho.github.io/cloud/digito/digito-note-1/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://harryho.github.io/cloud/digito/digito-note-1/</guid><description>&lt;h2 id="droplet"&gt;Droplet&lt;a class="anchor" href="#droplet"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;DigitalOcean Droplets are Linux-based virtual machines (VMs) that run on top of virtualized hardware. Each Droplet you create is a new server you can use, either standalone or as part of a larger, cloud-based infrastructure.&lt;/p&gt;
&lt;h3 id="prerequisite"&gt;Prerequisite&lt;a class="anchor" href="#prerequisite"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Prepare a bank account or credit card&lt;/li&gt;
&lt;li&gt;Signup DigitalOcean account and activate it&lt;/li&gt;
&lt;li&gt;Create a new prject&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="os-options"&gt;OS Options&lt;a class="anchor" href="#os-options"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Ubuntu&lt;/li&gt;
&lt;li&gt;FreeBSD&lt;/li&gt;
&lt;li&gt;Fedora&lt;/li&gt;
&lt;li&gt;Debian&lt;/li&gt;
&lt;li&gt;CentOS&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="plans-and-pricing"&gt;Plans and Pricing&lt;a class="anchor" href="#plans-and-pricing"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;We offer four different kinds of Droplet plans: one shared CPU plan and three dedicated CPU plans.&lt;/p&gt;</description></item><item><title>DigitialOcean: Get Started</title><link>https://harryho.github.io/cloud/digito/digito-note-2/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://harryho.github.io/cloud/digito/digito-note-2/</guid><description>&lt;h2 id="user-setup"&gt;User Setup&lt;a class="anchor" href="#user-setup"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="create-a-new-admin-user"&gt;Create a new admin user&lt;a class="anchor" href="#create-a-new-admin-user"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h4 id="add-a-new-user"&gt;Add a new user&lt;a class="anchor" href="#add-a-new-user"&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Add new user 
# set password
adduser &amp;lt;admin_user&amp;gt;

# user to sudo group
usermod -aG sudo &amp;lt;admin_user&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="set-ssh-access-for-new-user"&gt;Set SSH access for new user&lt;a class="anchor" href="#set-ssh-access-for-new-user"&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Switch session to new user 
su - &amp;lt;admin_user&amp;gt;

# navigate to user home 
cd

# Prepare ssh directory
mkdir .ssh
chmod 700 ~/.ssh

# Copy root key
sudo cp /root/.ssh/authorized_keys ~/.ssh/authorized_keys
chmod 644 /home/&amp;lt;admin_user&amp;gt;/.ssh/authorized_keys
sudo chown -R &amp;lt;admin_user&amp;gt;:&amp;lt;admin_user&amp;gt; ~/&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="login-as-new-user-via-ssh"&gt;Login as new user via SSH&lt;a class="anchor" href="#login-as-new-user-via-ssh"&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ssh -i ~/.ssh/&amp;lt;your_droplet_rsa&amp;gt; &amp;lt;admin_user&amp;gt;@&amp;lt;your_droplet_ip&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="set-root-password--disable-ssh"&gt;Set root password &amp;amp; disable SSH&lt;a class="anchor" href="#set-root-password--disable-ssh"&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo passwd

# rename key file
sudo mv /root/.ssh/authorized_keys /root/.ssh/disabled_authorized_keys&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="security-update"&gt;Security Update&lt;a class="anchor" href="#security-update"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Update only for security
sudo apt-get install unattended-upgrades

# Update security packages
sudo unattended-upgrade -d --dry-run
sudo unattended-upgrade -d

# Update quietly
sudo unattended-upgrade&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="tagging--cloud-firewall"&gt;Tagging &amp;amp; Cloud Firewall&lt;a class="anchor" href="#tagging--cloud-firewall"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Tags are custom labels you apply to Droplets that have multiple uses
&lt;ul&gt;
&lt;li&gt;Add tags to your droplet. e.g. my-web-server&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;DigitalOcean Cloud Firewalls are a free, network-based, stateful firewall service for your DigitalOcean Droplets. They block all traffic that isn’t expressly permitted by a rule. You can define the Droplets protected by a firewall individually or by using tags.&lt;/li&gt;
&lt;li&gt;Always setup Firewall for your droplets
&lt;ul&gt;
&lt;li&gt;Set SSH permission for only given IP address&lt;/li&gt;
&lt;li&gt;Set HTTP for port 80&lt;/li&gt;
&lt;li&gt;Set HTTPS for port 443&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="other-features"&gt;Other Features&lt;a class="anchor" href="#other-features"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="floating-ips"&gt;Floating IPs&lt;a class="anchor" href="#floating-ips"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;DigitalOcean Floating IPs are publicly-accessible static IP addresses that you can assign to Droplets. A floating IP provides an additional static address you can use to access a Droplet without replacing or changing the Droplet’s original public IP address.&lt;/p&gt;</description></item><item><title>DigitialOcean: First Web Host</title><link>https://harryho.github.io/cloud/digito/digito-note-3/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://harryho.github.io/cloud/digito/digito-note-3/</guid><description>&lt;blockquote class='book-hint '&gt;
&lt;p&gt;Here I contineu to setup SSL certificates for all sites on my web host&lt;/p&gt;
&lt;/blockquote&gt;&lt;h2 id="ufw"&gt;UFW&lt;a class="anchor" href="#ufw"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;UFW, or Uncomplicated Firewall, is a front-end to iptables. Its main goal is to make managing your firewall drop-dead simple and to provide an easy-to-use interface.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;DO NOT Enable UFW&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;DO NOT enable UFW without reading through the instructions&lt;/p&gt;
&lt;/blockquote&gt;&lt;h3 id="enable-ip-v6"&gt;Enable IP V6&lt;a class="anchor" href="#enable-ip-v6"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Open the UFW configuration with vi:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo vi /etc/default/ufw&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Make sure &amp;ldquo;IPV6&amp;rdquo; is set to &amp;ldquo;yes&amp;rdquo;, like so:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;...
IPV6=yes
...&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="set-default-rules"&gt;Set default rules&lt;a class="anchor" href="#set-default-rules"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo ufw deny incoming
sudo ufw allow outgoing&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="allow-ssh--openssh"&gt;Allow SSH / OpenSSH&lt;a class="anchor" href="#allow-ssh--openssh"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Check app list &amp;amp; enable OpenSSH&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# List applications
sudo ufw app list

# Allow SSH
sudo ufw allow OpenSSH&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Directly allow port 22 or other SSH port, e.g. 2222&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo ufw allow 22 &lt;/code&gt;&lt;/pre&gt;&lt;h3 id="enable-ufw"&gt;Enable UFW&lt;a class="anchor" href="#enable-ufw"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo ufw enable
sudo ufw sattus verbose&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="nginx"&gt;Nginx&lt;a class="anchor" href="#nginx"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="install-nginx"&gt;Install Nginx&lt;a class="anchor" href="#install-nginx"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt install ngix&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="set-ufw"&gt;Set UFW&lt;a class="anchor" href="#set-ufw"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# show applications 
sudo ufw app list

# Allow Nginx 
sudo ufw allow &amp;#39;Nginx Full&amp;#39;
sudo ufw reload&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="build-web-host-block"&gt;Build Web Host Block&lt;a class="anchor" href="#build-web-host-block"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="create-the-directory-structure"&gt;Create the Directory Structure&lt;a class="anchor" href="#create-the-directory-structure"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The document root is the directory where the website files for a domain name are stored and served in response to requests. You can set the document root to any location you want.&lt;/p&gt;</description></item><item><title>DigitialOcean: Lets Encrypt</title><link>https://harryho.github.io/cloud/digito/digito-note-4/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://harryho.github.io/cloud/digito/digito-note-4/</guid><description>&lt;blockquote class='book-hint '&gt;
&lt;p&gt;Here I continue to finish the web host setup. The last step of web host setup is to add SSL certificate for each site&lt;/p&gt;
&lt;/blockquote&gt;&lt;h3 id="lets-encrypt"&gt;Lets Encrypt&lt;a class="anchor" href="#lets-encrypt"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To enable HTTPS on your website, you need to get a certificate (a type of file) from a Certificate Authority (CA). &lt;a href="https://letsencrypt.org/"&gt;Let’s Encrypt&lt;/a&gt; is a CA. In order to get a certificate for your website’s domain from Let’s Encrypt, you have to demonstrate control over the domain. With Let’s Encrypt, you do this using software that uses the ACME protocol, which typically runs on your web host.&lt;/p&gt;</description></item></channel></rss>