<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Cước Thiên]]></title><description><![CDATA[Backend Developer]]></description><link>https://profile.cuocthien.io.vn/</link><image><url>https://profile.cuocthien.io.vn/favicon.png</url><title>Cước Thiên</title><link>https://profile.cuocthien.io.vn/</link></image><generator>Ghost 5.53</generator><lastBuildDate>Wed, 08 Apr 2026 18:12:40 GMT</lastBuildDate><atom:link href="https://profile.cuocthien.io.vn/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[A Beginner's Guide to Configuring VPS (EC2)]]></title><description><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text">In this tutorial, I&apos;ll walk you through the essential steps to configure an EC2 instance, including user management, file transfers, installing software, and configuring Nginx for your website.</div></div><h2 id="1-create-a-user-group-and-add-users">1. Create a User Group and Add Users</h2><blockquote>Managing users in your EC2 instance starts with setting up user</blockquote>]]></description><link>https://profile.cuocthien.io.vn/setup-vps/</link><guid isPermaLink="false">670d389921a92e0001f79ace</guid><category><![CDATA[Code]]></category><dc:creator><![CDATA[Cước Thiên]]></dc:creator><pubDate>Mon, 14 Oct 2024 16:25:17 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1573166855576-5e6dca380e7d?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDYxfHxJVHxlbnwwfHx8fDE3Mjg4MjY0Mjd8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text">In this tutorial, I&apos;ll walk you through the essential steps to configure an EC2 instance, including user management, file transfers, installing software, and configuring Nginx for your website.</div></div><h2 id="1-create-a-user-group-and-add-users">1. Create a User Group and Add Users</h2><blockquote>Managing users in your EC2 instance starts with setting up user groups.</blockquote><ul><li>Add a group:</li></ul><pre><code class="language-bash">sudo addgroup &lt;groupname&gt;</code></pre><ul><li>Add a user:</li></ul><pre><code class="language-bash">sudo adduser &lt;username&gt;
</code></pre><ul><li>Change the user password:</li></ul><pre><code class="language-bash">sudo passwd &lt;username&gt;
</code></pre><ul><li>Add user to the group:</li></ul><pre><code class="language-bash">sudo adduser &lt;username&gt; &lt;groupname&gt;
</code></pre><hr><h2 id="2-enable-ssh-with-user-accounts">2. Enable SSH with User Accounts</h2><blockquote>SSH access is crucial for managing your EC2 instance.</blockquote><ul><li>Edit the SSH configuration file:</li></ul><pre><code class="language-bash">sudo nano /etc/ssh/sshd_config
</code></pre><ul><li>Change <code>PasswordAuthentication</code> to <code>yes</code></li><li>Change <code>ChallengeResponseAuthentication</code> to <code>no</code></li><li>Restart the SSH service:</li></ul><pre><code class="language-bash">sudo systemctl restart sshd
</code></pre><hr><h2 id="3-set-user-and-group-permissions-for-filesfolders">3. Set User and Group Permissions for Files/Folders</h2><blockquote>To set specific permissions for users or groups on files or directories, you need to install ACL.</blockquote><ul><li>Install ACL:</li></ul><pre><code class="language-bash">sudo apt install acl
</code></pre><ul><li>Set permissions for a user:</li></ul><pre><code class="language-bash">setfacl -R -m u:&lt;username&gt;:&lt;permissions&gt; &lt;file/folder&gt;
</code></pre><ul><li>Set permissions for a group:</li></ul><pre><code class="language-bash">setfacl -R -m g:&lt;groupname&gt;:&lt;permissions&gt; &lt;file/folder&gt;
</code></pre><ul><li>Check permissions:</li></ul><pre><code class="language-bash">getfacl &lt;file/folder&gt;
</code></pre><hr><h2 id="4-install-and-configure-nginx">4. Install and Configure Nginx</h2><blockquote>Nginx is one of the most popular web servers for serving websites.</blockquote><ul><li>Install Nginx:</li></ul><pre><code class="language-bash">sudo apt install nginx
</code></pre><ul><li>Enable the Nginx service:</li></ul><pre><code class="language-bash">sudo ufw allow &apos;Nginx HTTP&apos;
</code></pre><ul><li>Create a custom Nginx server block:</li></ul><pre><code class="language-bash">sudo nano /etc/nginx/sites-available/&lt;your_domain&gt;
</code></pre><blockquote>Add your server configuration here.</blockquote><img src="https://images.unsplash.com/photo-1573166855576-5e6dca380e7d?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDYxfHxJVHxlbnwwfHx8fDE3Mjg4MjY0Mjd8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="A Beginner&apos;s Guide to Configuring VPS (EC2)"><p></p><figure class="kg-card kg-code-card"><pre><code class="language-bash">server {
    server_name profile.cuocthien.io.vn;
    location / {
        proxy_pass http://127.0.0.1:2368;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection &apos;upgrade&apos;;
        proxy_headers_hash_max_size 512;
        proxy_headers_hash_bucket_size 128;
    }
}</code></pre><figcaption>example for server nginx configuration file</figcaption></figure><ul><li>Link to <code>sites-enabled</code>:</li></ul><pre><code class="language-bash">sudo ln -s /etc/nginx/sites-available/&lt;your_domain&gt; /etc/nginx/sites-enabled/&lt;your_domain&gt;
</code></pre><ul><li>Restart Nginx:</li></ul><pre><code class="language-bash">sudo systemctl restart nginx
</code></pre><hr><h2 id="5-set-up-ssl-with-certbot">5. Set Up SSL with Certbot</h2><blockquote>To secure your website, use SSL with Certbot.</blockquote><ul><li>Install Certbot:</li></ul><pre><code class="language-bash">sudo apt install certbot python3-certbot-nginx
</code></pre><ul><li>Configure SSL:</li></ul><pre><code>sudo certbot --nginx -d yourdomain.com
</code></pre><ul><li>Double check </li></ul><pre><code class="language-bash">cat /etc/nginx/sites-available/&lt;your_domain&gt;</code></pre><blockquote>&#x2003;The result should be:</blockquote><pre><code class="language-bash">server {
    server_name profile.cuocthien.io.vn;
    location / {
        proxy_pass http://127.0.0.1:2368;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection &apos;upgrade&apos;;
        proxy_headers_hash_max_size 512;
        proxy_headers_hash_bucket_size 128;
    }



    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/profile.cuocthien.io.vn/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/profile.cuocthien.io.vn/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}</code></pre><hr><h2 id="6-install-pm2-to-manage-nodejs-applications">6. Install PM2 to Manage Node.js Applications</h2><blockquote>PM2 is a process manager for Node.js apps.</blockquote><ul><li>Install Node.js:</li></ul><pre><code class="language-bash">curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

source ~/.bashrc

nvm install node</code></pre><ul><li>Install PM2:</li></ul><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://pm2.keymetrics.io/docs/usage/quick-start/?ref=profile.cuocthien.io.vn"><div class="kg-bookmark-content"><div class="kg-bookmark-title">PM2 - Quick Start</div><div class="kg-bookmark-description">Advanced process manager for production Node.js applications. Load balancer, logs facility, startup script, micro service management, at a glance.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://pm2.keymetrics.io/favicon-96x96.png" alt="A Beginner&apos;s Guide to Configuring VPS (EC2)"><span class="kg-bookmark-author">PM2 logo</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://raw.githubusercontent.com/unitech/pm2/master/pres/pm2.20d3ef.png" alt="A Beginner&apos;s Guide to Configuring VPS (EC2)"></div></a></figure><pre><code class="language-bash">npm install pm2 -g
</code></pre><hr><h2 id="7-install-docker">7. Install Docker</h2><blockquote>Docker is essential for containerizing applications.</blockquote><ul><li><strong>Install Docker:</strong></li></ul><pre><code class="language-bash">sudo apt install apt-transport-https ca-certificates curl software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository &quot;deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable&quot;

sudo apt install docker-ce

sudo systemctl status docker
</code></pre><ul><li>Install Docker Compose:</li></ul><pre><code>sudo apt-get install docker-compose
</code></pre><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://docs.docker.com/get-started/?ref=profile.cuocthien.io.vn"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Get started</div><div class="kg-bookmark-description">Get started with Docker</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://docs.docker.com/favicons/docs@2x.ico" alt="A Beginner&apos;s Guide to Configuring VPS (EC2)"><span class="kg-bookmark-author">Docker Documentation</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://docs.docker.com/images/thumbnail.webp" alt="A Beginner&apos;s Guide to Configuring VPS (EC2)"></div></a></figure><hr><h2 id="helpful-tools">Helpful tools</h2><h3 id="a-managing-zip-and-unzip-files">a. Managing Zip and Unzip Files</h3><blockquote>If you need to work with compressed files, follow these commands:</blockquote><ul><li>Install Unzip:</li></ul><pre><code class="language-bash">sudo apt-get install unzip
</code></pre><ul><li>Unzip a file:</li></ul><pre><code class="language-bash">unzip file.zip -d destination_folder</code></pre><ul><li>Install Zip:</li></ul><pre><code class="language-bash">sudo apt-get install zip
</code></pre><ul><li>Zip a folder:</li></ul><pre><code class="language-bash">zip -r compressed_filename.zip foldername
</code></pre><p></p><h3 id="b-copying-files-between-local-and-remote">b. Copying Files Between Local and Remote</h3><blockquote>Transferring files between your local machine and EC2 instance can be done with <code>scp</code>:</blockquote><p>1. Upload from local to remote:</p><pre><code class="language-bash">scp -r /path/from/local username@hostname:/path/to/remote
</code></pre><p>2. Download from remote to local:</p><pre><code class="language-bash">scp -r username@hostname:/path/from/remote /path/to/local
</code></pre><p>3. For custom SSH ports:</p><pre><code class="language-bash">scp -r -P xxxx username@hostname:/path/from/remote /path/to/local
</code></pre><p></p><hr><div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-emoji">&#x1F43C;</div><div class="kg-callout-text">Thank you for taking the time to read through this guide! I hope these steps help you successfully configure your EC2 instance and manage your projects with ease. Whether you&apos;re setting up users, transferring files, or deploying applications, this guide is designed to provide a solid foundation for your cloud journey. If you found this helpful or have any further questions, feel free to reach out. Happy coding, and best of luck with your EC2 setup!</div></div>]]></content:encoded></item><item><title><![CDATA[Welcome to my blog!]]></title><description><![CDATA[<p>I&apos;m a backend developer with a passion for building scalable, secure, and performant applications. I&apos;ve been working in the industry for 3 years and have experience with a variety of programming languages, frameworks, and databases.</p><p>This blog is more than just a place to share my</p>]]></description><link>https://profile.cuocthien.io.vn/coming-soon/</link><guid isPermaLink="false">661566a9a23b7a00011ae933</guid><category><![CDATA[News]]></category><dc:creator><![CDATA[Cước Thiên]]></dc:creator><pubDate>Tue, 09 Apr 2024 16:02:49 GMT</pubDate><media:content url="https://static.ghost.org/v4.0.0/images/feature-image.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://static.ghost.org/v4.0.0/images/feature-image.jpg" alt="Welcome to my blog!"><p>I&apos;m a backend developer with a passion for building scalable, secure, and performant applications. I&apos;ve been working in the industry for 3 years and have experience with a variety of programming languages, frameworks, and databases.</p><p>This blog is more than just a place to share my knowledge of backend technology; it&apos;s also a place for me to document my life experiences, my perspectives, and my thoughts on life. As a programmer, my work is closely tied to computers and lines of code, so I hope that through this blog, I can share other aspects of my life so that people can get to know me better.</p><p>In this blog, I&apos;ll be sharing about:</p><ul><li><strong><strong>Backend programming knowledge:</strong></strong> I&apos;ll discuss the pros and cons of different backend programming languages. I&apos;ll also share my own experiences using these languages to build real-world applications.</li><li><strong>IT knowledge<strong>:</strong></strong> I&apos;ll discuss different types of fields, tools and experiences.</li><li><strong><strong>Life experiences:</strong></strong> I&apos;ll share stories about the projects I&apos;ve worked on, the challenges I&apos;ve faced, and the lessons I&apos;ve learned.</li><li><strong><strong>Thoughts on life:</strong></strong> I&apos;ll share my thoughts on various issues in life, from work, family, and friends to broader social issues.</li></ul><p>I believe that backend development is a challenging and rewarding field. I&apos;m excited to share my knowledge and experience with others and help them become better backend developers.</p><p>I hope this blog will be a place where you can find useful information about backend programming, and also share your thoughts and experiences in life with me.</p><p>Please follow my blog for the latest updates!</p>]]></content:encoded></item></channel></rss>