<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Linux on juni&#39;s blog ٩(◕‿◕｡)۶</title>
    <link>/categories/linux/</link>
    <description>Recent content in Linux on juni&#39;s blog ٩(◕‿◕｡)۶</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sun, 22 Jun 2025 00:00:00 +0000</lastBuildDate><atom:link href="/categories/linux/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Tracking &amp; Syncing my dotfiles!</title>
      <link>/posts/16/managing-my-dotfiles/</link>
      <pubDate>Sun, 22 Jun 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/16/managing-my-dotfiles/</guid>
      <description>&lt;p&gt;&lt;em&gt;.dotfiles or&amp;hellip; (.)²files?&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;--using-git--github--tracking-dotfiles-with-an-alias&#34;&gt;- Using Git + Github, &amp;amp; tracking dotfiles with an alias.&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&amp;hellip; as mentioned on the &lt;a href=&#34;https://wiki.archlinux.org/title/Dotfiles#Tracking_dotfiles_directly_with_Git&#34;&gt;ever-wise &lt;em&gt;Arch Wiki&lt;/em&gt;.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 1. Create a bare Git repo to track dotfiles&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git init --bare ~/.dotfiles
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 2. Create an alias to simplify dotfiles management.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Tells (/usr/bin/git) to link the git alias directory you just created to your real .config/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;alias dotfiles&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 3. Hide untracked files in ~/ from cluttering &amp;#34;git status&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dotfiles config status.showUntrackedFiles no
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Setup &amp;amp; communicate with this repo via &lt;code&gt;ssh&lt;/code&gt;, &lt;a href=&#34;https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent?platform=linux&#34;&gt;authenticating with a local private key&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 4. Generate SSH key for GitHub auth (if you haven&amp;#39;t got one already)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ssh-keygen -t ed25519 -C &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;you@example.com&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ssh-add ~/.ssh/id_ed25519
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Add the value of ~/.ssh/id_ed25519.pub as an entry in your Github --&amp;gt; Settings --&amp;gt; SSH &amp;amp; GPG Keys, via cat + copy-pasting, or however you&amp;#39;d like.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 5. Force git on your machine to always push to github with SSH instead of HTTPS&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git config --global url.&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;git@github.com:&amp;#34;&lt;/span&gt;.insteadOf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;https://github.com/&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 6. Set upstream branch as origin main &amp;amp; push via ssh!&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dotfiles push --set-upstream origin main
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;then, upon changing my &lt;code&gt;dotfiles&lt;/code&gt;, can push to github with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dotfiles status&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dotfiles add XXXXX&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dotfiles commit -m &amp;quot;Update shell and Hyprland config&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dotfiles push&lt;/code&gt; (to remote, via SSH)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;--or-using-a-dotfiles-manager-comme&#34;&gt;- or&amp;hellip; using a dotfiles manager, &lt;em&gt;comme &lt;a href=&#34;https://www.chezmoi.io/quick-start/#concepts&#34;&gt;&lt;code&gt;chezmoi&lt;/code&gt;&lt;/a&gt;.&lt;/em&gt;&lt;/h2&gt;
&lt;p&gt;&amp;hellip; which is a tool that essentially creates a copy of your &lt;code&gt;dotfiles&lt;/code&gt; folder &lt;em&gt;&lt;strong&gt;outside&lt;/strong&gt;&lt;/em&gt; of your &lt;code&gt;/home&lt;/code&gt; directory (e.g. in &lt;code&gt;~/.local/share/chezmoi/private_dot_config/&lt;/code&gt;) to act as a place to &lt;strong&gt;stage&lt;/strong&gt;, &lt;strong&gt;synchronise&lt;/strong&gt; (with &lt;code&gt;git&lt;/code&gt;) &amp;amp; &lt;strong&gt;manage&lt;/strong&gt; changes to your local &lt;code&gt;dotfiles.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I think of it as a &lt;strong&gt;remotely-connected playground for your &lt;code&gt;dotfiles&lt;/code&gt;&lt;/strong&gt;, to mess with them, pull them from remote repos etc., &lt;strong&gt;before applying the changes&lt;/strong&gt; (via symlinks, copying, or templating) into your &lt;strong&gt;local&lt;/strong&gt; home directory (e.g. &lt;code&gt;~/.config&lt;/code&gt;).&lt;/p&gt;
&lt;h3 id=&#34;--to-install&#34;&gt;- To install:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sudo pacman -S chezmoi&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chezmoi init&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Check what is &amp;amp; isn&amp;rsquo;t managed by &lt;code&gt;chezmoi&lt;/code&gt; with &lt;code&gt;chezmoi managed&lt;/code&gt;/&lt;code&gt;chezmoi unmanaged&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&amp;hellip; then follow steps on &lt;a href=&#34;https://www.chezmoi.io/quick-start/#start-using-chezmoi-on-your-current-machine&#34;&gt;this tutorial&lt;/a&gt; to connect to your repository &amp;amp; get your first commit. I&amp;rsquo;m using &lt;code&gt;chezmoi&lt;/code&gt; to push to the same remote &lt;code&gt;dotfiles&lt;/code&gt; repo created above, and so just &lt;code&gt;rebased&lt;/code&gt; my changes (overwriting the old, &lt;code&gt;chezmoi&lt;/code&gt;-less &lt;code&gt;dotfiles&lt;/code&gt; from above) to keep it nice and clean.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;--editing-your-dotfiles--using-chezmoi&#34;&gt;- Editing your dotfiles &amp;amp; using &lt;code&gt;chezmoi&lt;/code&gt;:&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;You can edit your &lt;code&gt;dotfiles&lt;/code&gt; in &lt;a href=&#34;https://www.chezmoi.io/user-guide/frequently-asked-questions/usage/#how-do-i-edit-my-dotfiles-with-chezmoi&#34;&gt;multiple ways&lt;/a&gt; with &lt;code&gt;chezmoi&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&#34;-you-can-work-and-make-changes-within-the-locally-created-chezmoi-copy-of-your-dotfiles-apply-them-locally-and-push-them-to-remote-repo-once-done&#34;&gt;&lt;strong&gt;(&lt;code&gt;RECOMMENDED&lt;/code&gt;)&lt;/strong&gt; You can work and make changes within the locally-created &lt;code&gt;chezmoi&lt;/code&gt; copy of your &lt;code&gt;dotfiles&lt;/code&gt;, apply them locally, and push them to remote repo once done.&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Navigate to your &lt;code&gt;chezmoi&lt;/code&gt; dotfiles copy with &lt;code&gt;chezmoi cd&lt;/code&gt; (you should be able to tell that it&amp;rsquo;s the &lt;code&gt;chezmoi&lt;/code&gt;-managed copy - e.g. it&amp;rsquo;s called &lt;code&gt;private_dot_config&lt;/code&gt; for me).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then, once you&amp;rsquo;ve made changes and are ready to see them/apply them to your &lt;strong&gt;real&lt;/strong&gt; &lt;code&gt;dotfiles&lt;/code&gt; (e.g to see changes live made to your desktop GUI), use &lt;code&gt;chezmoi status&lt;/code&gt; to list all changed files, &lt;code&gt;chezmoi diff&lt;/code&gt; to check any changes, and &lt;code&gt;chezmoi apply&lt;/code&gt; to copy the &lt;code&gt;chezmoi&lt;/code&gt;-managed files over to your &lt;em&gt;&lt;strong&gt;local&lt;/strong&gt;&lt;/em&gt; &lt;code&gt;dotfiles.&lt;/code&gt; Now, you should see any changes made &lt;strong&gt;reflected on your live system&lt;/strong&gt; (after reloading the given services, if applicable)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Then²&lt;/em&gt;, once you&amp;rsquo;re ready to update your remote repo with your changes, go through the usual &lt;code&gt;git commit&lt;/code&gt; process within the &lt;code&gt;chezmoi&lt;/code&gt;-managed directory.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;git status&lt;/code&gt; to see all changed files (within the &lt;code&gt;chezmoi&lt;/code&gt;-managed copy)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;git add .&lt;/code&gt; (or whatever files you want to add)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;git commit -m &amp;quot;cool changes&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;git push origin main&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;However&lt;/strong&gt;&lt;/em&gt;, you also have the option of&amp;hellip;&lt;/p&gt;
&lt;h3 id=&#34;-ie-not-within-the-chezmoi-managed-copy-of-your-dotfiles&#34;&gt;&lt;strong&gt;&amp;hellip;making changes to your dotfiles normally&lt;/strong&gt; (i.e. not within the &lt;code&gt;chezmoi&lt;/code&gt;-managed copy of your &lt;code&gt;dotfiles&lt;/code&gt;)&lt;/h3&gt;
&lt;p&gt;So, after you&amp;rsquo;re finished a &lt;a href=&#34;https://i.ytimg.com/vi/GlSa_gh8xaQ/maxresdefault.jpg&#34;&gt;particularly spicy ricing session&lt;/a&gt;, you can run:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chezmoi status&lt;/code&gt; - to see what&amp;rsquo;s changed between your local &lt;code&gt;dotfiles&lt;/code&gt; and &lt;code&gt;chezmoi&lt;/code&gt;&amp;rsquo;s copy.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chezmoi add ~/.config/path/to/file.config&lt;/code&gt; - to add any &lt;strong&gt;locally-changed files&lt;/strong&gt; to &lt;code&gt;chezmoi&lt;/code&gt;&amp;rsquo;s tracked &amp;amp; &lt;code&gt;git&lt;/code&gt;-managed copy.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chezmoi apply -v&lt;/code&gt; to write these local changes to &lt;code&gt;chezmoi&#39;s&lt;/code&gt; working copy of your &lt;code&gt;dotfiles&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then switch to the &lt;code&gt;chezmoi&lt;/code&gt;-managed copy with &lt;code&gt;cd chezmoi&lt;/code&gt;, and go through the usual &lt;code&gt;git commit&lt;/code&gt; process to &lt;strong&gt;update your remote repo if desired.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;code&gt;chezmoi&lt;/code&gt;, importantly, allows you to do some of the following cool things:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up your &lt;code&gt;dotfiles&lt;/code&gt; on a new machine with a single command:
&lt;code&gt;chezmoi init --apply https://github.com/$GITHUB_USERNAME/dotfiles.git&lt;/code&gt; (public repo - private requires &lt;a href=&#34;https://docs.github.com/en/get-started/git-basics/about-remote-repositories#cloning-with-https-urls&#34;&gt;other methods&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Using &lt;strong&gt;&lt;a href=&#34;https://www.chezmoi.io/reference/templates/&#34;&gt;templates&lt;/a&gt;&lt;/strong&gt; to manage &lt;code&gt;dotfiles&lt;/code&gt; between different machines/distros.&lt;/li&gt;
&lt;li&gt;Encrypting your &lt;code&gt;dotfiles&lt;/code&gt; using &lt;strong&gt;&lt;a href=&#34;https://www.chezmoi.io/user-guide/password-managers/&#34;&gt;secrets from your password manager&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>&#39;securely&#39; setting up web server with nginx @ home &amp; self hosting</title>
      <link>/posts/9/securely-self-hosting-site-npm/</link>
      <pubDate>Thu, 26 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>/posts/9/securely-self-hosting-site-npm/</guid>
      <description>&lt;ol&gt;
&lt;li&gt;debian 12 container install inside proxmox&lt;/li&gt;
&lt;li&gt;`sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y&lt;/li&gt;
&lt;li&gt;network settings: If your router supports subnets/VLANs, connect this to the isolated VLAN. within proxmox, assign static IP not in use and point to your router&amp;rsquo;s gateway.![[Screenshot 2024-07-08 at 8.40.32 PM.png]]&lt;/li&gt;
&lt;li&gt;install nginx on debian - &lt;code&gt;sudo apt install nginx -y&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;create a file for website settings: `nano /etc/nginx/sites-available/mywebsite&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;server&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;listen&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt; ; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;listen&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;[::]:80&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;server_name&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;juni-mp4.org&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;root&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;/var/www/juni-web&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;index.html&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;index.htm&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;index.nginx-debian.html&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;location&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#f92672&#34;&gt;try_files&lt;/span&gt; $uri $uri/ =&lt;span style=&#34;color:#ae81ff&#34;&gt;404&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;listen&lt;/code&gt; lines tell &lt;code&gt;nginx&lt;/code&gt; to listen for connections on both IPv4 and IPv6.
The &lt;code&gt;server_name&lt;/code&gt; is the website that we are looking for. By putting &lt;code&gt;landchad.net&lt;/code&gt; here, that means whenever someone connects to this server and is looking for that address, they will be directed to the content in this block. &lt;code&gt;root&lt;/code&gt; specifies the directory we&amp;rsquo;re going to put our website files in.&lt;/p&gt;
&lt;p&gt;This can theoretically be wherever, but it is conventional to have them in &lt;code&gt;/var/www/&lt;/code&gt;. Name the directory in that whatever you want. &lt;code&gt;index&lt;/code&gt; determine what the &amp;ldquo;default&amp;rdquo; file is; normally when you go to a website, say &lt;code&gt;landchad.net&lt;/code&gt;, you are actually going to a file at &lt;code&gt;landchad.net/index.html&lt;/code&gt;. That&amp;rsquo;s all that is. Note that that this in concert with the line above mean that &lt;code&gt;/var/www/landchad/index.html&lt;/code&gt;, a file on our computer that we&amp;rsquo;ll create, will be the main page of our website.&lt;/p&gt;
&lt;p&gt;Lastly, the &lt;code&gt;location&lt;/code&gt; block is really just telling the server how to look up files, otherwise throw a 404 error. Location settings are very powerful, but this is all we need them for now.
7. create directory for your website&amp;rsquo;s contents/files using: &lt;code&gt;mkdir /var/www/juni-web&lt;/code&gt; (can be located wherever but standard to store in &lt;code&gt;/var/www/[X]&lt;/code&gt; ) where you can place website files like &lt;code&gt;index.html&lt;/code&gt; etc.)
8. enable the site by making a link between the config file in you just created in &lt;code&gt;sites-available&lt;/code&gt; and the &lt;code&gt;sites-enabled&lt;/code&gt; directory:
&lt;code&gt;ln -s /etc/nginx/sites-available/juni-web /etc/nginx/sites-enabled/ 9. restart nginx &lt;/code&gt;systemctl restart nginx`&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;make sure the &amp;ldquo;default&amp;rdquo; file doesn&amp;rsquo;t remain in &lt;code&gt;/etc/nginx/sites-enabled/&lt;/code&gt; otherwise will serve the default config page for nginx!!&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;main-nginx-files--explanation&#34;&gt;Main Nginx Files &amp;amp; Explanation:&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;The idea is that you can make a site configuration file in &lt;code&gt;sites-available&lt;/code&gt; (that links to where your website is stored locally, e.g. &lt;code&gt;/var/www/sitestorage&lt;/code&gt;), then make a link to this configuration file in &lt;code&gt;sites-enabled&lt;/code&gt;, which will activate it.&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&#34;config-files&#34;&gt;Config Files:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;/etc/nginx/sites-available/&lt;/code&gt; - directory containing any site configuration files. Points to directory containing main website content, e.g. &lt;code&gt;/var/www/juni-web&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;server&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;listen&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;listen&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;[::]:80&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;server_name&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;juni-mp4.org&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;root&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;/var/www/juni-web&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;index.html&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;index.htm&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;index.nginx-debian.html&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;location&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#f92672&#34;&gt;try_files&lt;/span&gt; $uri $uri/ =&lt;span style=&#34;color:#ae81ff&#34;&gt;404&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;/etc/nginx/sites-enabled/&lt;/code&gt; - directory containing &lt;strong&gt;links&lt;/strong&gt; to site configuration files
make links via: `ln -s [link-source-path] [link-destination-path]&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;main-website-location&#34;&gt;Main website location:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/var/www/[site-name]&lt;/code&gt;&#39;
e.g. &lt;code&gt;/var/www/juni-web&lt;/code&gt;
contains files like index.html, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;securing-it&#34;&gt;Securing it:&lt;/h1&gt;
&lt;h3 id=&#34;ufw&#34;&gt;UFW:&lt;/h3&gt;
&lt;p&gt;sudo apt install ufw&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Limit SSH access to port 22 
sudo ufw limit 22/tcp 

# Allow HTT![[Screenshot 2024-07-19 at 9.04.25 PM.png]]P traffic on port 80 
sudo ufw allow 80 

# Allow HTTPS traffic on port 443 
sudo ufw allow 443 

# Limit SSH access to port 22 for IPv6 
sudo ufw limit 22/tcp6 

# Allow HTTP traffic on port 80 for IPv6 
sudo ufw allow 80/tcp6 

# Allow HTTPS traffic on port 443 for IPv6 
sudo ufw allow 443/tcp6

ufw enable

ufw logging on

ufw status
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;![[Screenshot 2024-07-09 at 11.51.31 PM.png]]
&lt;a href=&#34;https://www.linode.com/docs/guides/configure-firewall-with-ufw/&#34;&gt;https://www.linode.com/docs/guides/configure-firewall-with-ufw/&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&#34;docker-install-debian&#34;&gt;docker install (&lt;a href=&#34;https://docs.docker.com/engine/install/debian/&#34;&gt;debian&lt;/a&gt;):&lt;/h1&gt;
&lt;p&gt;Run the following command to uninstall all conflicting packages:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; pkg in docker.io docker-doc docker-compose podman-docker containerd runc; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; sudo apt-get remove $pkg; &lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;install dependencies:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Set up Docker&amp;rsquo;s &lt;code&gt;apt&lt;/code&gt; repository.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Add Docker&amp;#39;s official GPG key:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get install ca-certificates curl
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo install -m &lt;span style=&#34;color:#ae81ff&#34;&gt;0755&lt;/span&gt; -d /etc/apt/keyrings
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo chmod a+r /etc/apt/keyrings/docker.asc
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Add the repository to Apt sources:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#ae81ff&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;deb [arch=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;dpkg --print-architecture&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;. /etc/os-release &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$VERSION_CODENAME&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; stable&amp;#34;&lt;/span&gt; | &lt;span style=&#34;color:#ae81ff&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;  sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;install latest docker version&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Verify that the installation is successful by running the &lt;code&gt;hello-world&lt;/code&gt; image:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; sudo docker run hello-world
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;docker-compose-install&#34;&gt;docker compose install&lt;/h2&gt;
&lt;p&gt;why install it? manage all containers &amp;amp; deployments from a &lt;a href=&#34;https://docs.docker.com/compose/&#34;&gt;single yaml file&lt;/a&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get install docker-compose-plugin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker compose version
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;![[Screenshot 2024-07-10 at 12.12.09 AM.png]]&lt;/p&gt;
&lt;p&gt;create compose file near website data for ease of management&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## if website located in mkdir /var/www/juni-web&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir /var/www/docker-compose
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano docker-compose.yml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;we can use this to install&amp;hellip;&lt;/p&gt;
&lt;h3 id=&#34;nginx-proxy-manager-npm-install&#34;&gt;nginx proxy manager (NPM) install&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;(not to be confused with node package manager npm lol)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;note: make sure to set ports for managing nginx proxy manager (NPM) to 8080 &amp;amp; 4443 (or whatever custom ones you&amp;rsquo;d like) and NOT 80 &amp;amp; 443, as the latter will likely be in use by nginx to serve &amp;amp; access your website at.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;in the docker-compose.yml&amp;hellip;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd /var/www/docker-compose
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano docker-compose.yml
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## then add into file:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;services:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  app:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    image: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;jc21/nginx-proxy-manager:latest&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    restart: unless-stopped
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ports:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# These ports are in format &amp;lt;host-port&amp;gt;:&amp;lt;container-port&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;8080:80&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# Port for HTTP access to NPM&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;4443:443&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# Port for HTTS access to NPM&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;81:81&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# Admin Web Port&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# Add any other Stream port you want to expose&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# - &amp;#39;21:21&amp;#39; # FTP&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# Uncomment the next line if you uncomment anything in the section&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# environment:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# Uncomment this if you want to change the location of&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# the SQLite DB file within the container&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# DB_SQLITE_FILE: &amp;#34;/data/database.sqlite&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# Uncomment this if IPv6 is not enabled on your host&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# DISABLE_IPV6: &amp;#39;true&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    volumes:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - ./data:/data
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - ./letsencrypt:/etc/letsencrypt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## then run&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker compose up -d
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;access nginx via &lt;code&gt;http://[server-ip]:81&lt;/code&gt; &amp;amp; login with &lt;code&gt;admin@example.com&lt;/code&gt; and &lt;code&gt;changeme&lt;/code&gt;  (changed upon entry)&lt;/p&gt;
&lt;h2 id=&#34;cloudflare-setup&#34;&gt;cloudflare setup&lt;/h2&gt;
&lt;p&gt;sign up for free cloudflare account
follow signup steps to point existing domain at cloudflare&lt;/p&gt;
&lt;p&gt;autoscan for any DNS records you changed with your registrar (* domains, subdomains etc.) so cloudflare is aware of them&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 9.05.00 PM.png]]
![[Screenshot 2024-07-19 at 9.09.40 PM.png]]&lt;/p&gt;
&lt;p&gt;navigate to your domain registrar and set the custom DNS servers to the ones provided to you by cloudflare.&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 9.08.37 PM.png]]&lt;/p&gt;
&lt;p&gt;cloudflare setup guide here - &lt;a href=&#34;https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/&#34;&gt;https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/&lt;/a&gt;
![[Screenshot 2024-07-19 at 9.17.23 PM.png]]
![[Screenshot 2024-07-19 at 9.17.34 PM.png]]
![[Screenshot 2024-07-19 at 9.18.03 PM.png]]&lt;/p&gt;
&lt;p&gt;API token:  HRWvk067sLPv_RMGDPhS1y0lj5XDcLErat5nY18m
verify with cul command:
&lt;code&gt;   curl -X GET &amp;quot;https://api.cloudflare.com/client/v4/user/tokens/verify&amp;quot; \        -H &amp;quot;Authorization: Bearer [YOUR TOKEN]&amp;quot; \ -H &amp;quot;Content-Type:application/json&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;cloudflare--ssl-issues-certbot&#34;&gt;Cloudflare &amp;amp; SSL issues (certbot)&lt;/h3&gt;
&lt;p&gt;if you&amp;rsquo;ve setup certbot or something similar to manage ssl certificates on your nginx server, MAKE SURE to go to cloudflare and select Full (strict) SSL/TLS encryption mode so it doesn&amp;rsquo;t have an SSL mismatch and make your site inaccessible via the browser - ![[Screenshot 2024-07-19 at 10.00.00 PM.png]]&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Why:&lt;/strong&gt; as with &lt;strong&gt;&amp;lsquo;flexible&amp;rsquo;&lt;/strong&gt; ticked, cloudflare will (by default) try and make requests to your server via HTTP and the server will throw an error if it&amp;rsquo;s using SSL due to a cipher mismatch, then browsers interpret this as a potential MiTM attack. see below: ![[Screenshot 2024-07-19 at 10.03.20 PM.png]]
![[Screenshot 2024-07-19 at 10.03.46 PM.png]]&lt;/p&gt;
&lt;p&gt;you can also check your site&amp;rsquo;s nginx config file to see that certs are set up properly:&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 10.07.33 PM.png]]&lt;/p&gt;
&lt;h2 id=&#34;opening-the-ports&#34;&gt;OPENING the ports&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;External port&lt;/strong&gt;: what port is used by external users to access, like:
&lt;code&gt;pu.bl.ic.ip:[external-port]&lt;/code&gt;
e.g. &lt;code&gt;182.46.382.83:443&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Internal port&lt;/strong&gt;: what port on the specified &lt;strong&gt;Device&lt;/strong&gt; (the one identified by the &lt;code&gt;Device IP Address&lt;/code&gt; field) that the traffic will be forwarded to.&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 10.24.08 PM.png]]&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 10.23.53 PM.png]]&lt;/p&gt;
&lt;h2 id=&#34;set-up-static-ip-for-container-in-proxmox-on-router&#34;&gt;set up static IP for container in proxmox on router&lt;/h2&gt;
&lt;p&gt;OR just change the DHCP pool to not include the IP address you want statically added on the proxmox&lt;/p&gt;
&lt;p&gt;(e.g. setting DNS pool to &lt;code&gt;192.168.0.20&lt;/code&gt; -&amp;gt;  &lt;code&gt;192.168.0.200&lt;/code&gt; and then assigning static IP for your container in proxmox outside of the pool range but on the same subnet, e.g. &lt;code&gt;192.168.0.5&lt;/code&gt; )
![[Screenshot 2024-07-19 at 10.19.57 PM.png]]&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 10.19.45 PM.png]]&lt;/p&gt;
&lt;h2 id=&#34;adding-ssl-cert-to-nginx-proxy-manager&#34;&gt;adding SSL cert to nginx proxy manager&lt;/h2&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 10.40.02 PM.png]]&lt;/p&gt;
&lt;p&gt;certs on web server:
![[Screenshot 2024-07-19 at 10.43.38 PM.png]]&lt;/p&gt;
&lt;h2 id=&#34;setup-proxy-host-on-npm&#34;&gt;setup proxy host on NPM&lt;/h2&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 11.37.22 PM.png]]
![[Screenshot 2024-07-19 at 11.38.09 PM.png]]&lt;/p&gt;
&lt;h2 id=&#34;setup-npm--dynamic-dns&#34;&gt;setup NPM &amp;amp; dynamic DNS&lt;/h2&gt;
&lt;p&gt;to do:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; &lt;a href=&#34;https://anebula.io/how-to-set-up-nginx-proxy-manager-using-docker-compose/&#34;&gt;https://anebula.io/how-to-set-up-nginx-proxy-manager-using-docker-compose/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; &lt;a href=&#34;https://www.youtube.com/watch?v=GarMdDTAZJo&#34;&gt;https://www.youtube.com/watch?v=GarMdDTAZJo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; &lt;a href=&#34;https://notthebe.ee/blog/easy-ssl-in-homelab-dns01/&#34;&gt;https://notthebe.ee/blog/easy-ssl-in-homelab-dns01/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; set up nginx reverse proxy, cloudflare etc. &lt;a href=&#34;https://blog.prutser.net/2021/01/20/how-to-securely-self-host-a-website-or-web-app/&#34;&gt;https://blog.prutser.net/2021/01/20/how-to-securely-self-host-a-website-or-web-app/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; install certbot &amp;amp; auto renewal &amp;amp; setup https&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; setup firewall around docker - &lt;a href=&#34;https://docs.docker.com/network/packet-filtering-firewalls/#docker-and-ufw&#34;&gt;https://docs.docker.com/network/packet-filtering-firewalls/#docker-and-ufw&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; ssh harden copy config files &amp;amp; replace keys&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; install auto updates for all respective software (docker, docker compose, nginx, nginx proxy manager, ufw, anything else used)&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; port forward website to internet to make accessible&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; update domain registrar to point to local public IP&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; write scp command that writes locally-edited files to website remotely
&lt;code&gt;scp -r user@[remoteTargetComputerIP]: [RemoteFilesPath] [localDestinationPath] e.g. &lt;/code&gt;scp -r &lt;a href=&#34;mailto:root@45.77.26.67&#34;&gt;root@45.77.26.67&lt;/a&gt;:/var/www/mysite ~&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;DISCLAIMER:&lt;/strong&gt; &lt;em&gt;I would consider this a LEGACY POST of mine, written a long time ago. Please excuse any typos, errors or lapses in memory/judgement - as it was added to the site from the archives, just to put everything in one place. Thankq for your understanding 🙇‍♀️&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
</description>
    </item>
    
    <item>
      <title>Backing up linux .config &amp; apps to move to a new device/distro</title>
      <link>/posts/8/backup-linux-config-and-apps/</link>
      <pubDate>Wed, 25 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>/posts/8/backup-linux-config-and-apps/</guid>
      <description>&lt;h1 id=&#34;burn-it-all-down-or&#34;&gt;burn it all down&amp;hellip; or?&lt;/h1&gt;
&lt;p&gt;Ahh, a tale born from the first time that I dipped my toes into the weird, wide and wonderful world of distro-hopping. Because sometimes, instead of building it all from scratch again (like so many of us are fond of doing), bringing your old config, notes of a previous home, with you is desirable. Because don&amp;rsquo;t lie - we won&amp;rsquo;t get those hours spent tweaking shell configs to look &lt;em&gt;just&lt;/em&gt; how we like it back.&lt;/p&gt;
&lt;p&gt;In any case - the following (somewhat high-level) overview should get you up and running on a new system/distro fairly quickly, in an environment&lt;/p&gt;
&lt;p&gt;Basically, most user settings (from my research - some may be hidden in other corners, but this got me back to a similar place) are stored in `/home/[user-name]/.config/.&lt;/p&gt;
&lt;p&gt;So, for me, this was at &lt;code&gt;/home/juni/.config/&lt;/code&gt;. So, simply copy that folder to an external drive or over the network, and paste it in the corresponding place on your new system.&lt;/p&gt;
&lt;h2 id=&#34;--copying-over-config&#34;&gt;- Copying over .config&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;cd /home/[user]/&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;navigate to the user&amp;rsquo;s directory where the &lt;code&gt;.config&lt;/code&gt; folder is stored.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;`sudo tar cvzf configs-backup.tgz .config/&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;creates a compressed archive (&lt;code&gt;configs-backup.tgz&lt;/code&gt;) of the &lt;code&gt;.config&lt;/code&gt; folder with &lt;code&gt;tar&lt;/code&gt;, and passing &lt;code&gt;cvzf&lt;/code&gt; as parameters:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;c&lt;/code&gt; - &lt;code&gt;c&lt;/code&gt;reate a new archive&lt;/li&gt;
&lt;li&gt;&lt;code&gt;v&lt;/code&gt; - enable &lt;code&gt;v&lt;/code&gt;erbose output, to monitor the progress&lt;/li&gt;
&lt;li&gt;&lt;code&gt;z&lt;/code&gt; - compress with the g&lt;code&gt;z&lt;/code&gt;ip algorithm&lt;/li&gt;
&lt;li&gt;&lt;code&gt;f&lt;/code&gt; - specifies the name of the created archive &lt;code&gt;f&lt;/code&gt;ile (in this case, &lt;code&gt;configs-backup.tgz&lt;/code&gt;)
Alternatively, you could use a tool like &lt;code&gt;rsync&lt;/code&gt; to copy the &lt;strong&gt;entire&lt;/strong&gt; &lt;code&gt;/home/&lt;/code&gt; folder to an external ssd, although this can take a &lt;strong&gt;long time&lt;/strong&gt; depending on its size. I&amp;rsquo;d recommend &lt;code&gt;rsync&lt;/code&gt; over just copying with &lt;code&gt;cp&lt;/code&gt;, as &lt;code&gt;rsync&lt;/code&gt; copies all files &lt;strong&gt;whilst&lt;/strong&gt; retaining &lt;code&gt;owner/group/other&lt;/code&gt; file permissions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If connecting an external SSD to copy to:
`sudo fdisk -l&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;lists the connected disk drives and their corresponding filesystem location - like `/dev/sda1)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;`sudo mkdir -p /mnt/externalssd&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;creates a folder on your computer&amp;rsquo;s filesystem to act as a &lt;strong&gt;mount point:&lt;/strong&gt; i.e. a place where you can access files stored on a mounted external SSD.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;`sudo mount -t exfat /dev/sda1 /mnt/externalssd&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Mounting the SSD (the device we found at &lt;code&gt;/dev/sda1&lt;/code&gt;) &amp;lsquo;in&amp;rsquo; this new folder created in the previous step, allowing all the files on it to appear in &lt;code&gt;/mnt/externalssd&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You should now be able to navigate there with &lt;code&gt;cd /mnt/externalssd&lt;/code&gt; and run a &lt;code&gt;ls&lt;/code&gt; to show the SSD&amp;rsquo;s existing contents. Then, copy the compressed .config file with &lt;code&gt;cp /home/[user]/configs-backup.tgz /mnt/externalssd&lt;/code&gt; (may require prepending &lt;code&gt;sudo&lt;/code&gt; depending on user permissions) - and you&amp;rsquo;re done!.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you opted for &lt;code&gt;rsync&lt;/code&gt; instead above:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo rsync -avh --progress /home/[user]/ /mnt/externalssd/home-backup&lt;/code&gt;
- &lt;code&gt;a&lt;/code&gt; - preserves file &lt;code&gt;a&lt;/code&gt;ttributes &amp;amp; ensures a &lt;strong&gt;mirror copy&lt;/strong&gt; is created, including permissions, symlinks, etc.
- &lt;code&gt;v&lt;/code&gt; - enable &lt;code&gt;v&lt;/code&gt;erbose output, to monitor the progress
- &lt;code&gt;h&lt;/code&gt; - ensures output is &lt;code&gt;h&lt;/code&gt;uman-readable
- &lt;code&gt;--progress&lt;/code&gt; - displays real-time progress for troubleshooting purposes.&lt;/p&gt;
&lt;ol start=&#34;7&#34;&gt;
&lt;li&gt;
&lt;p&gt;Now just unmount the drive with &lt;code&gt;sudo umount /mnt/externalssd&lt;/code&gt; (or don&amp;rsquo;t - live on the edge ;), plug it into new machine/distro, and copy the file you created over into &lt;code&gt;/home/[new-user]/&lt;/code&gt; with &lt;code&gt;cp&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Make sure to de-compress the file (if you used &lt;code&gt;tar&lt;/code&gt;) with &lt;code&gt;tar xvzf configs-backup.tgz&lt;/code&gt;, so it can be read by the system!&lt;/p&gt;
&lt;p&gt;Then reboot, and your settings should be re-applied! :3&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;--bonus-grabbing-a-list-of-installed-packages-to-re-install&#34;&gt;- BONUS: Grabbing a list of installed packages to re-install&lt;/h2&gt;
&lt;p&gt;Optionally, if you want to grab a list of all packages/apps installed on your current distro to bring over and auto-install on your new one, run the following:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Debian-based distros (e.g. Ubuntu, Kali, etc.):&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;dpkg --get-selections &amp;gt; installed-packages.txt&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;saves a list of all packages to &lt;code&gt;installed-packages.txt&lt;/code&gt;. Save this on an external SSD or transfer to the new machine via the network.
&lt;strong&gt;On the New Machine/Distro:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo apt update&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Navigate to where &lt;code&gt;installed-packages.txt&lt;/code&gt; is stored (on the local machine), and run &lt;code&gt;sudo dpkg --set-selections &amp;lt; installed-packages.txt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo apt-get dselect-upgrade&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The process is similar for distributions using different package managers like &lt;code&gt;yum&lt;/code&gt;, &lt;code&gt;pacman&lt;/code&gt;, or &lt;code&gt;rpm&lt;/code&gt;, the concept is the same but the commands will differ slightly. A little net/manual searching will fix you up :P.&lt;/p&gt;
&lt;h2 id=&#34;--related-helpful-articles&#34;&gt;- Related helpful articles:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://help.ubuntu.com/community/BackupYourSystem/TAR&#34;&gt;https://help.ubuntu.com/community/BackupYourSystem/TAR&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://askubuntu.com/questions/7809/how-to-back-up-my-entire-system&#34;&gt;https://askubuntu.com/questions/7809/how-to-back-up-my-entire-system&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;DISCLAIMER:&lt;/strong&gt; &lt;em&gt;I would consider this a LEGACY POST of mine, written a long time ago. Please excuse any typos, errors or lapses in memory/judgement - as it was added to the site from the archives, just to put everything in one place. Thankq for your understanding 🙇‍♀️&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
</description>
    </item>
    
  </channel>
</rss>
