<?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: DaNeil C</title>
    <description>The latest articles on DEV Community by DaNeil C (@caffiendkitten).</description>
    <link>https://dev.to/caffiendkitten</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%2F176046%2Fda23df9e-2327-4d27-9900-81b8e3baa830.png</url>
      <title>DEV Community: DaNeil C</title>
      <link>https://dev.to/caffiendkitten</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/caffiendkitten"/>
    <language>en</language>
    <item>
      <title>Nevertheless, She Persisted... And Got a Job!</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Wed, 31 Mar 2021 22:48:20 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/nevertheless-she-persisted-and-got-a-job-5dej</link>
      <guid>https://dev.to/caffiendkitten/nevertheless-she-persisted-and-got-a-job-5dej</guid>
      <description>&lt;p&gt;5 years ago I wouldn't have imagined being a Security Consultant.&lt;br&gt;
In 2016 I was studying Information Technology and taking interest in Security Engineering.&lt;br&gt;
In 2021 I start my career as a Security Consultant.&lt;/p&gt;

&lt;h2&gt;
  
  
  My most recent achievement was…
&lt;/h2&gt;

&lt;p&gt;Like most stories of finally making it, it's been a long road to get here. I've moved twice, lost a 19-yo loved cat, got 2 new butthead cats, got a degree, started a coding bootcamp, finished a coding bootcamp, got rid of a ex, found a new love, and quit a job I really enjoyed.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dscNnS0U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://pbs.twimg.com/media/DK0ArUVXoAADwgh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dscNnS0U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://pbs.twimg.com/media/DK0ArUVXoAADwgh.jpg" alt="" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
It's all coming to a peak in April because this month I signed the contract.&lt;br&gt;
&lt;a href="https://i.giphy.com/media/88i76jKvkTc1p9qZxe/giphy-downsized.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/88i76jKvkTc1p9qZxe/giphy-downsized.gif" alt="woot woot" width="244" height="244"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  My biggest job related goal is…
&lt;/h2&gt;

&lt;p&gt;My biggest job related goal has always been &lt;code&gt;Getting a job without asking for one/help.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I know... it's crazy talk right?!&lt;br&gt;
I've always heard that "&lt;code&gt;it's all about who you know in tech because they will be the ones hiring you&lt;/code&gt;," but I never wanted to ask someone I know to hire me or ask my bf to have one of his friends hire me. &lt;br&gt;
&lt;a href="https://i.giphy.com/media/LPrAK9rEedDwjtL1J0/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/LPrAK9rEedDwjtL1J0/giphy.gif" width="498" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've always gotten any job I've had on my own; so for me, getting a job this way felt empty and petty. It felt like networking wasn't about making a real connection with a potential colleague or have an interest conversation. It felt like I was collecting connections like Pokémon Cards to later try and get them to hire me and this never sat well with me.&lt;/p&gt;

&lt;p&gt;That being said, there is nothing wrong with asking for help when you need it. We all struggle in our own ways and I just wanted to achieve this own my own. No one will help in an actually interview and I didn't want to fill my LinkedIn with random recruiters that were 5+ connections away from me. I wanted to focus on what I was learning and let the work speak for itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advocating for myself looks like…
&lt;/h2&gt;

&lt;p&gt;Previously, I have always had to work a full time+ job and then go to school. I never felt like I was really making progress except getting a degree. &lt;br&gt;
&lt;a href="https://i.giphy.com/media/ZZW1IpzmrDMJxbHolS/giphy-downsized.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/ZZW1IpzmrDMJxbHolS/giphy-downsized.gif" width="480" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before I started dating this guy I had already decided to take the leap and start on this path. I had quit my job and started a coding bootcamp. Since the beginning he encouraged me to take time off of retail work so I could actually study (and helped me study) to change careers... er. well, start a career. &lt;/p&gt;

&lt;p&gt;I took full advantage of this and treated (almost) everyday like a job and studied more than I had before. CTFs and conference on weekends, any conference talk I could listen to during the week, Network+ training, Security+ training, and having bf quiz me on OWASP Top 10 topics.&lt;br&gt;
&lt;a href="https://i.giphy.com/media/LMcB8XospGZO8UQq87/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/LMcB8XospGZO8UQq87/giphy.gif" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  My advice for allies to support folks who code is...
&lt;/h2&gt;

&lt;p&gt;I was reading recently that Women make up &lt;a href="http://womenscyberjutsu.org"&gt;20% of the Cyber Security workforce&lt;/a&gt;, but I'm a web app penetration tester... and these numbers are even lower.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1dfn5ewlq6ld9qwudicl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1dfn5ewlq6ld9qwudicl.png" alt="Alt Text" width="585" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A recent &lt;a href="https://docs.google.com/spreadsheets/d/1TWvPQalmwl1sIS3n2eOU4KST4oJwcxtSfT8lMo9IgVM/edit#gid=691164905"&gt;open survey&lt;/a&gt; I found polled 400+ people in cyber security and only 28 respondents were women, with a total of ~39 were non-male. &lt;a href="https://docs.google.com/forms/d/e/1FAIpQLSfwJPoFoUhrQMpDv3fwa8ItcZHwriIjLDBkAiFalXXNp88bFA/viewanalytics"&gt;6.9% of 400+&lt;/a&gt; identified at women. &lt;/p&gt;

&lt;p&gt;If these numbers are even a kind of ok representation of women in my field I'm admittedly a bit sad, but this doesn't surprise me. Though I've met a few women hackers/pentesters locally, of the people that I know personally in cyber security no one ever mentions women on their red team. I don't blame anyone for this, nor do I think people should hire a women/non-male to simply have equal representation of genders on his team. Though it is important to have a more diverse collection of humans to share ideas and different views, I (personally) have the same opportunity/ability to apply for a role as anyone else with a computer; and if a male has more skills than me I would expect them to get hired over me. If a cat has more skills than me I would expect them to get hired over me.&lt;/p&gt;

&lt;p&gt;My advice for allies is to create more roles for new people and take more chances on people that might not be 100% yet, but are on the right track. You might be surprised how hard they work to hold their own and make the risk worth it.&lt;br&gt;
&lt;a href="https://i.giphy.com/media/nTLfUAvPjn7l3YbABP/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/nTLfUAvPjn7l3YbABP/giphy.gif" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The next steps for me
&lt;/h2&gt;

&lt;p&gt;I start a job soon and I need to keep it.&lt;br&gt;
I need to keep up my studies and hold my own. &lt;br&gt;
&lt;a href="https://i.giphy.com/media/26FL4BaDc1lgVpg52/giphy-downsized.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/26FL4BaDc1lgVpg52/giphy-downsized.gif" width="480" height="268"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" alt="Happy Hacking ^_^" width="500" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>wecoded</category>
      <category>security</category>
      <category>codenewbie</category>
      <category>hack</category>
    </item>
    <item>
      <title>PentesterLab: File Include</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Tue, 16 Mar 2021 20:41:51 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/pentesterlab-file-include-c6g</link>
      <guid>https://dev.to/caffiendkitten/pentesterlab-file-include-c6g</guid>
      <description>&lt;p&gt;A lot of applications need to include files to load classes or to share some templates between multiple web pages. A File Inclusion Vulnerability allows an attacker to access unauthorized or sensitive files on the web server or to execute malicious files by making use of the &lt;code&gt;include()&lt;/code&gt; functionality.(2)&lt;/p&gt;

&lt;h1&gt;
  
  
  How?
&lt;/h1&gt;

&lt;p&gt;The File Include Vulnerabilities come from a lack of filtering when a user-controlled parameter is used as part of a file name in a call to an including function (require, require_once, include or include_once in PHP for example). &lt;/p&gt;

&lt;p&gt;If the call to one of these methods is vulnerable, an attacker can manipulate the function to load their own code which &lt;strong&gt;can lead to:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Local File Include: LFI. A local file is loaded, read, and interpreted, such as directory traversal to read arbitrary files.&lt;/li&gt;
&lt;li&gt;Remote File Include: RFI. A remote file is retrieved and interpreted.&lt;/li&gt;
&lt;li&gt;If the arbitrary code contains an opening PHP tag, the file will be interpreted as PHP code.(1)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Testing
&lt;/h2&gt;

&lt;p&gt;If you are on a website, such as PentesterLabs File Include Lab, and you can see an error message once you inject a special character (&lt;code&gt;"&lt;/code&gt;) into the url parameter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning: include(intro.php'): failed to open stream: 
No such file or directory in /var/www/fileincl/example1.php on line 7 
Warning: include(): Failed opening 'intro.php'' 
for inclusion (include_path='.:/usr/share/php:/usr/share/pear') 
in /var/www/fileincl/example1.php on line 7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you read the error message carefully, you can extract a lot of information such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The path of the script: /var/www/fileincl/example1.php.&lt;/li&gt;
&lt;li&gt;The function used: include().&lt;/li&gt;
&lt;li&gt;The value used in the call to include is the value we injected intro.php' without any addition or filtering.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From here you can also use the methods used to detect directory traversal and to detect file include, such as applying the &lt;code&gt;../../../etc/passwd&lt;/code&gt; technique in the URL.&lt;/p&gt;

&lt;h1&gt;
  
  
  Mitigation
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;By default, modern PHP disables loading of remote files, thanks to the configuration option: allow_url_include but that doesn't mean that it's not exploitable if the PHP version is not current.&lt;/li&gt;
&lt;li&gt;Applying proper filtering of user-controlled parameters or supplying users with specific parameter options.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  References
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://pentesterlab.com/"&gt;https://pentesterlab.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://resources.infosecinstitute.com/file-inclusion-attacks/#gref"&gt;https://resources.infosecinstitute.com/file-inclusion-attacks/#gref&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h6&gt;
  
  
  Please Note that I am still learning. If something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
&lt;/h6&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>codenewbie</category>
      <category>vuln</category>
    </item>
    <item>
      <title>Application Server &amp; CORS Config</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Wed, 06 Jan 2021 23:43:19 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/app-server-cors-config-1b40</link>
      <guid>https://dev.to/caffiendkitten/app-server-cors-config-1b40</guid>
      <description>&lt;p&gt;At this point basically everything is set up but you probably can't access anything yet or your may only be able to see a landing page with no useful information on it. This is because the Apache HTTP Server doesn't know how to communicate with the Ruby API. &lt;a href="https://i.giphy.com/media/jRx6JhvYbL6fbC65qF/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/jRx6JhvYbL6fbC65qF/giphy.gif" alt="Communication is key"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See, for a dynamic application like a Rails API there needs to be some kind of Rack-Compatible Server to handle the incoming requests that the HTTP server isn't able to process. This is where an &lt;a href="https://dev.to/caffiendkitten/building-a-home-test-server-27h1#WebServerVsHTTPServer"&gt;Application Server&lt;/a&gt;, like &lt;a href="https://www.phusionpassenger.com/"&gt;Phusion Passenger&lt;/a&gt; or Apache Tomcat, or a Rack-compatible web server, like &lt;a href="https://puma.io/"&gt;Puma&lt;/a&gt;, are needed to process the dynamic content requests got the HTTP server.&lt;/p&gt;

&lt;p&gt;Because I had built a Rack specific application there are, like always, a few ways you could set this up.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You could set up Apache with a reverse proxy for a stand alone Rack-specific web server, like Puma or Unicorn.&lt;/li&gt;
&lt;li&gt;You could use an Apache module, like Phusion Passenger, to manage the processes and any needed reverse proxying.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Though I was originally using Puma as a stand alone server, and because it's &lt;a href="https://devcenter.heroku.com/changelog-items/594"&gt;Heroku's Recommended Ruby Webserver&lt;/a&gt;, this section will be about my process of changing over to the &lt;a href="https://dev.to/caffiendkitten/building-a-home-test-server-27h1#WebServerVsHTTPServer"&gt;Application Server&lt;/a&gt;, Passenger, to help handle the Ruby on Rails routing and how I dealt with &lt;a href="https://dev.to/caffiendkitten/building-a-home-test-server-27h1#CORS"&gt;CORS&lt;/a&gt; for my API. That being said, if you created your own Rails API from scratch for this you might not want to use Passenger and use a straight PHP interface or Puma instead. &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Table Of Contents&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Step 1: Adding in an Application Server&lt;br&gt;
Step 2: Setting Apache Passenger configuration&lt;br&gt;
Step 3: Accessing Rails Routes&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;a&gt;Step 1: Adding in an Application Server&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;First thing first is to add Passenger into the server to be used. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the applications "backend" folder, if not there already, with &lt;code&gt;cd /var/www/etcpasswdapp/backend&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo nano Gemfile&lt;/code&gt; to edit the Gemfile.&lt;/li&gt;
&lt;li&gt;If it's there, "comment out" the Puma gem in the Gemfile by placing a &lt;code&gt;#&lt;/code&gt; at the beginning of the Puma gem line. &lt;/li&gt;
&lt;li&gt;Now add &lt;code&gt;gem "passenger", "&amp;gt;= 5.0.25", require: "phusion_passenger/rack_handler"&lt;/code&gt; (the Passenger gem) below the commented out Puma gem.&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YuSFYKjD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/utvl5nz8sv0s8lrz5qnx.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Save and close the file.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the Passenger packages into Ubuntu with the following &lt;code&gt;sudo&lt;/code&gt; commands.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install our PGP key and add HTTPS support for APT with:
    sudo apt-get install -y dirmngr gnupg
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
    sudo apt-get install -y apt-transport-https ca-certificates
Add our APT repository with:
    sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger focal main &amp;gt; /etc/apt/sources.list.d/passenger.list'
     sudo apt-get update
Install Passenger with:
    sudo apt-get install -y passenger
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;bundle install&lt;/code&gt; to ensure that all the gem dependencies are up to date and the passenger gem in installed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;passenger-install-apache2-module&lt;/code&gt; to run the Passenger Apache module installer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Check the package was installed correctly with &lt;code&gt;sudo /usr/bin/passenger-config validate-install&lt;/code&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It might give you an option to check the path or the install like mine did below. Use the up and down arrows to select one and press "enter" to select it. I recommend running it twice to check both have a valid install.&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qvOcuO7u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bmorac4v1bhl70uvvtxh.jpg" alt="Validate Passenger"&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now run &lt;code&gt;sudo a2enmod passenger&lt;/code&gt; to enable the Passenger Apache module.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Because I am using Ubuntu 20.04 for this project got stuck here and found out that I needed to also configure my main Apache "conf" file. If you are not using Ubuntu 20.04 you might skip the next step for setting up the Apache Passenger Configuration, but you might want to read it over if something applies to you.&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 2: Setting Apache Passenger configuration&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;When I ran the the command &lt;code&gt;sudo a2enmod passenger&lt;/code&gt; to enable the Passenger Apache module in the previous step, it returned some information about a "passenger.load" file and a "passenger.conf" file. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--54utUgsD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xqx1549h0xnyocz3204y.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--54utUgsD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xqx1549h0xnyocz3204y.jpg" alt="Returned Text"&gt;&lt;/a&gt; At the time I didn't understand it but after some research it turns out that for Apache 20.04 some &lt;a href="https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/apache/working_with_the_apache_config_file.html"&gt;additional configurations&lt;/a&gt; need to be added to the Apache "conf" file to specify the location of the passenger files. Refer to &lt;a href="https://www.phusionpassenger.com/library/config/apache/intro.html"&gt;this tutorial&lt;/a&gt; if something doesn't make since. &lt;sup&gt;4&lt;/sup&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate into the "mods-enabled" folder with &lt;code&gt;cd /etc/apache2/mods-enabled&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo nano passenger.load&lt;/code&gt; to edit the passenger file.&lt;/li&gt;
&lt;li&gt;Add the "LoadModule" that was output and comment out the current "LoadModule" location.

&lt;ul&gt;
&lt;li&gt;See pic in part 6 for what it should look like.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Save the file and exit the editor.&lt;/li&gt;
&lt;li&gt;Now run &lt;code&gt;sudo nano passenger.conf&lt;/code&gt; to edit the passenger conf file.&lt;/li&gt;
&lt;li&gt;Add the "&lt;code&gt;&amp;lt;IfModule mod_passenger.c&amp;gt;&lt;/code&gt;" that was output and comment out any other informaiton in the file.

&lt;ul&gt;
&lt;li&gt;Both your "passenger.load" file and a "passenger.conf" file should look like this: &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M2WL8kOj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dxv6e7j89c0qo6f97qnb.jpg" alt="Modified files"&gt;
&lt;/li&gt;
&lt;li&gt;Note: Because my files were previously created on the first module install attempt I only needed to modify them. If for some reason the files are not already created you will probably need to create the &lt;code&gt;/etc/apache2/mods-available/passenger.load&lt;/code&gt; file and add the "LoadModule" directive that passenger-install-apache2-module outputs and create the &lt;code&gt;/etc/apache2/mods-available/passenger.conf&lt;/code&gt; file and paste the "PassengerRoot" and other Passenger options that were output by the module.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Enable the module again by running &lt;code&gt;sudo a2enmod passenger&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;If this doesn't work hopefully you typed in something wrong and it's an easy fix. If not try checking out the &lt;a href="https://www.phusionpassenger.com/docs/advanced_guides/troubleshooting/"&gt;Passenger TroubleShooting&lt;/a&gt; pages or the &lt;a href="https://www.phusionpassenger.com/library/admin/apache/log_file/#location-of-the-log-file"&gt;logs&lt;/a&gt; and see what it's telling you.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now navigate into the "sites-enabled" folder with &lt;code&gt;cd /etc/apache2/sites-enabled&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo nano etcpasswdapi.conf&lt;/code&gt; to edit the file.&lt;/li&gt;
&lt;li&gt;Add the Passender specific configuration for "Development" and the "PassengerRuby".

&lt;ul&gt;
&lt;li&gt;For example, &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xXsx9_yH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/v76ese393fef9xxyli9c.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Restart Apache with &lt;code&gt;sudo apache2ctl restart&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Check that it worked by navigating to the site that your API is at on your client computer.

&lt;ul&gt;
&lt;li&gt;Because my API doesn't have an &lt;code&gt;index.html&lt;/code&gt; landing page I needed to create a temporary &lt;code&gt;index.html&lt;/code&gt; file in the "public" folder to ensure general connectivity. &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5qTbS5f0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xoebgs761r19bfqqur5s.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 3: Accessing Rails Routes&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;At this point you will probably be able to see the index page (as shown in the previous step) but if you want to access specific API routes to process data, you need to add in some &lt;a href="https://dev.to/caffiendkitten/building-a-home-test-server-27h1#CORS"&gt;CORS&lt;/a&gt; specifications to allow access to secure content. See, although the frontend and backend live on the same server they don't have the same origin. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GfVvNa9G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://javascript.info/article/url/url-object.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GfVvNa9G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://javascript.info/article/url/url-object.svg" alt=""&gt;&lt;/a&gt; For this to work the Apache headers module will be needed. &lt;/p&gt;

&lt;p&gt;The &lt;a href="https://httpd.apache.org/docs/current/mod/mod_headers.html"&gt;Apache headers module&lt;/a&gt; is one that will allow for control over the responses from the server. They can, and should, be set specific to each application on it.&lt;/p&gt;

&lt;p&gt;In my case I am using HTTPS for both the frontend and backend of my application so I need to set up both &lt;code&gt;conf&lt;/code&gt; files.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To enable the headers module run &lt;code&gt;sudo a2enmod headers&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Navigate to the Apache2 folder with &lt;code&gt;cd /etc/apache2/sites-enabled&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Edit the frontends "conf" file with &lt;code&gt;sudo nano etcpasswdapp.conf&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;With the editor open add &lt;code&gt;Header set Access-Control-Allow_Origin "*"&lt;/code&gt; to the &lt;code&gt;&amp;lt;Directory&amp;gt;&lt;/code&gt; section.&lt;/li&gt;
&lt;li&gt;Save and close the file.&lt;/li&gt;
&lt;li&gt;Now open the 'conf' file for the backend with &lt;code&gt;sudo nano etcpasswdapi.conf&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;With the editor open add &lt;code&gt;Header set Access-Control-Allow_Origin "http://etcpasswdapp.com"&lt;/code&gt; to the &lt;code&gt;&amp;lt;Directory&amp;gt;&lt;/code&gt; section.&lt;/li&gt;
&lt;li&gt;Save and close the file.&lt;/li&gt;
&lt;li&gt;Restart apache with &lt;code&gt;systemctl restart apache2&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If all works you should be able to see your frontend &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nLC9-rKp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5ejbfkafyyygzvmwi2cm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nLC9-rKp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5ejbfkafyyygzvmwi2cm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
and use it to interact with your API &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kb-N2blk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/znxgo5drl176v70bz4f9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kb-N2blk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/znxgo5drl176v70bz4f9.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;p&gt;DONE!!!!&lt;br&gt;
&lt;a href="https://i.giphy.com/media/eHDYhKUFlSuoIUrVY4/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/eHDYhKUFlSuoIUrVY4/giphy.gif" alt="Glad that is over"&gt;&lt;/a&gt;&lt;br&gt;
This last part was not that easy for me and took a few days to figure out and configure. Between all the spelling errors of mine and the lack of documentation for Ubuntu 20.04 I had to piece together things to make it all work for my set up. Feel free to ask questions and I  hope I can help.&lt;/p&gt;

&lt;p&gt;Now that that's done it's time to harden the server, test the application I built, and fix things.&lt;/p&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" alt="Happy Hacking ^_^"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;p&gt;&lt;a&gt;1.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/bionic/install_passenger.html"&gt;https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/bionic/install_passenger.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;2.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/standalone/install/oss/focal.html"&gt;https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/standalone/install/oss/focal.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;3.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/apache/install/oss/focal.html"&gt;https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/apache/install/oss/focal.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;4.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/library/install/apache/working_with_the_apache_config_file.html"&gt;https://www.phusionpassenger.com/library/install/apache/working_with_the_apache_config_file.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;5.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/rubygems_norvm/install_passenger.html#step-2:-run-the-passenger-apache-module-installer"&gt;https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/rubygems_norvm/install_passenger.html#step-2:-run-the-passenger-apache-module-installer&lt;/a&gt;&lt;br&gt;
&lt;a&gt;6.&lt;/a&gt; &lt;a href="https://medium.com/@thorntonbrenden/rails-and-the-legendary-master-key-15c8be7799f1"&gt;https://medium.com/@thorntonbrenden/rails-and-the-legendary-master-key-15c8be7799f1&lt;/a&gt;&lt;br&gt;
&lt;a&gt;7.&lt;/a&gt; &lt;a href="https://linuxize.com/post/how-to-install-ruby-on-ubuntu-20-04/"&gt;https://linuxize.com/post/how-to-install-ruby-on-ubuntu-20-04/&lt;/a&gt;&lt;br&gt;
&lt;a&gt;8.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/apache/working_with_the_apache_config_file.html"&gt;https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/apache/working_with_the_apache_config_file.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;9.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/docs/tutorials/deploy_to_production/deploying_your_app/oss/aws/ruby/apache/#rails_configure-database-yml-and-secrets-yml"&gt;https://www.phusionpassenger.com/docs/tutorials/deploy_to_production/deploying_your_app/oss/aws/ruby/apache/#rails_configure-database-yml-and-secrets-yml&lt;/a&gt;&lt;br&gt;
&lt;a&gt;10.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/library/walkthroughs/start/ruby.html"&gt;https://www.phusionpassenger.com/library/walkthroughs/start/ruby.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;11.&lt;/a&gt; &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-use-postgresql-with-your-ruby-on-rails-application-on-ubuntu-18-04"&gt;https://www.digitalocean.com/community/tutorials/how-to-use-postgresql-with-your-ruby-on-rails-application-on-ubuntu-18-04&lt;/a&gt;&lt;br&gt;
&lt;a&gt;12.&lt;/a&gt; &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-a-ruby-on-rails-project-with-a-react-frontend"&gt;https://www.digitalocean.com/community/tutorials/how-to-set-up-a-ruby-on-rails-project-with-a-react-frontend&lt;/a&gt;&lt;br&gt;
&lt;a&gt;13.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/library/config/apache/intro.html"&gt;https://www.phusionpassenger.com/library/config/apache/intro.html&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  Please Note: that I am still learning and if something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
  
&lt;/h5&gt;

</description>
      <category>codenewbie</category>
      <category>todayilearned</category>
      <category>sideprojects</category>
      <category>security</category>
    </item>
    <item>
      <title>Adding Ruby on Rails to a Server</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Wed, 06 Jan 2021 19:32:38 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/adding-ruby-on-rails-to-a-server-1n4b</link>
      <guid>https://dev.to/caffiendkitten/adding-ruby-on-rails-to-a-server-1n4b</guid>
      <description>&lt;p&gt;This series is so close to being done but not quite.&lt;br&gt;
&lt;a href="https://i.giphy.com/media/eXo5eC1tK7cas/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/eXo5eC1tK7cas/giphy.gif" alt="the end is near!"&gt;&lt;/a&gt;&lt;br&gt;
If you've kept up till now your application's frontend is (hopefully) functional on your home server with Heroku hosting its backend API. It's now time to migrate the Rails API and its Database into the server.&lt;/p&gt;

&lt;p&gt;At this point there are, again, a few options you could do: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up the "pgAdmin", PostgreSQL Tools, and interact with the admin and development platform in a GUI.&lt;/li&gt;
&lt;li&gt;Create a fresh Rails API for the application to interface with the PostgreSQL database on the server.&lt;/li&gt;
&lt;li&gt;Rewrite the application have the frontend and backend together with something like a Ruby on Rails base and React functionality to display the public "views" folder of the Ruby application.&lt;/li&gt;
&lt;li&gt;Create a PHP interface for the frontend to interact with the ProgreSQL database.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Because I already have a Ruby on Rails API built I'm going to download that repository and configure a private endpoint for the frontend to interact with it.&lt;br&gt;
If you need a refresher the difference between an API and a database, refer to my &lt;a href="https://dev.to/caffiendkitten/api-database-4le6"&gt;API =/= Database&lt;/a&gt; post.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Table Of Contents&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Step 1: Installing Ruby and Rails&lt;br&gt;
Step 2: Downloading and Configuring the API Repository&lt;br&gt;
Step 3: Adding the Backend Endpoints&lt;br&gt;
Step 4: Adding SSL&lt;br&gt;
Step 5: Adding in an Application Server&lt;br&gt;
Step 6: Configure database.yml and secrets.yml&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 1: Installing Ruby and Rails&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Before I add the API repository onto the server both &lt;a href="https://www.ruby-lang.org/en/"&gt;Ruby&lt;/a&gt; and &lt;a href="https://rubyonrails.org/"&gt;Rails&lt;/a&gt; need to be installed. For this I'm going to follow the &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-18-04"&gt;Digital Ocean tutorial&lt;/a&gt; for installing Ruby on Rails with &lt;a href="https://github.com/rbenv/rbenv"&gt;rbenv&lt;/a&gt; on my Ubuntu server, with a few changes for my specific system that I will list as needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; For this step I did find that if you run the commands as the "Root" user you will run into some issues; so I recommend using the &lt;code&gt;sudo&lt;/code&gt; command as needed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First I will run &lt;code&gt;sudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev&lt;/code&gt;. For this command I will need to change the &lt;code&gt;libgdbm5&lt;/code&gt; (that's for Ubuntu 18) to &lt;code&gt;libgdbm6&lt;/code&gt; (that's for Ubuntu 20).

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;autoconf&lt;/code&gt; is " a tool for producing shell scripts that automatically configure software source code packages to adapt to many kinds of Posix-like systems" &lt;sup&gt;19&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bison&lt;/code&gt; "is a general-purpose parser generator that converts an annotated context-free grammar into a deterministic LR or generalized LR (GLR) parser employing LALR(1), IELR(1) or canonical LR(1) parser tables." &lt;sup&gt;20&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;build-essential&lt;/code&gt; is "a meta-package that includes the GNU compiler collection, GNU debugger, and other development libraries and tools required for compiling software." &lt;sup&gt;21&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;libssl-dev&lt;/code&gt; is the OpenSSL project's implementation of the SSL/TLS cryptographic protocols for secure communication over the Internet. &lt;sup&gt;22&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;libyaml-dev&lt;/code&gt; "is a C library for parsing and emitting data in YAML 1.1, a human-readable data serialization format." &lt;sup&gt;23&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;libreadline6-dev&lt;/code&gt; is the GNU readline and history library that "aids in the consistency of user interface across discrete programs that need to provide a command line interface." &lt;sup&gt;24&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;zlib1g-dev&lt;/code&gt; "is a library implementing the deflate compression method found in gzip and PKZIP." &lt;sup&gt;25&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;libncurses5-dev&lt;/code&gt; is the "ncurses library routines are a terminal-independent method of updating character screens with reasonable optimization." &lt;sup&gt;26&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;libffi-dev&lt;/code&gt; is "a foreign function interface... that allows code written in one language to call code written in another language." &lt;sup&gt;27&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;libgdbm6&lt;/code&gt; and &lt;code&gt;libgdbm-dev&lt;/code&gt; are both a version of the GNU dbm ('gdbm') "library of database functions that use extendible hashing and works similarly to the standard UNIX 'dbm' functions." &lt;sup&gt;28&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;-dev&lt;/code&gt; part speaks to the development libraries, header files, and manpages for the packages.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Clone the "rbenv" repository into the "~/.rbenv" folder with &lt;code&gt;git clone https://github.com/rbenv/rbenv.git ~/.rbenv&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add "rbenv" to your command line &lt;code&gt;$PATH&lt;/code&gt; with the following commands&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SrJJKGqq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/x09nop0ojhglalk4ojo8.png" alt="Alt Text"&gt;

&lt;ul&gt;
&lt;li&gt;To get this command to permanently take hold I needed Root privileges and not just run the commands with &lt;code&gt;sudo&lt;/code&gt;. Without Root privileges my system would not product any output for the next step. I am not sure if this will effect things with other imaginary users but it was the only way I could get the &lt;code&gt;source ~/.bashrc&lt;/code&gt; command to work.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Test the configuration with &lt;code&gt;type rbenv&lt;/code&gt; which should produce the output of &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r9n-9prh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2tagb388bygbcifs34gg.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Clone the rbenv ruby build part of the repository into the &lt;code&gt;~/.rbenv/plugins/ruby-build&lt;/code&gt; folder with &lt;code&gt;git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Install the version of Ruby that you need with &lt;code&gt;rbenv install 2.6.6&lt;/code&gt;. 

&lt;ul&gt;
&lt;li&gt;I needed Ruby Version 2.6.6 but you can install any one you need. To see available versions to install run &lt;code&gt;rbenv install -l&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;At this point I actually had a weird thing happen where I think I installed Ruby Version 2.7 and I ended up needing uninstall ruby with the command &lt;code&gt;sudo apt purge ruby&lt;/code&gt; as "Root" and then I was able to install the proper version of Ruby with the rbenv.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;At this point you can run &lt;code&gt;gem install bundler&lt;/code&gt;  to manage the gem dependencies for your application.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To reiterate... If you installed rbenv as Root you might have trouble. Rbenv seems to not like being installed as root so only run with "sudo" if it insists.&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 2: Downloading and Configuring the API Repository&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Depending on if you are downloading an already built API from GitHub, downloading one from your client computer over SSH, or creating a new API will depend on how you do this step. &lt;br&gt;
Because I already have a Rails API built for my application on GitHub I will go through the same steps here to download the repository as I did with my &lt;a href="https://dev.to/caffiendkitten/adding-react-to-a-server-nm6#S2"&gt;React frontend&lt;/a&gt; into a folder named "backend" in the application's main folder.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate into the folder your application will live in with &lt;code&gt;cd /var/www/etcpasswdapp&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Same as with the React frontend, run &lt;code&gt;sudo git clone https://github.com/yourGitHubProject.git backend&lt;/code&gt; to clone the backend repository into a new folder named "backend", in the "etcpasswdapp" folder.

&lt;ul&gt;
&lt;li&gt; Now if you &lt;code&gt;cd backend&lt;/code&gt; into the "backend" folder you just created and run &lt;code&gt;git status&lt;/code&gt; you can see that the folder is linked up to GitHub for some great version control and backup ability of your application.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;Gemfile.Lock&lt;/code&gt; is there delete it with &lt;code&gt;sudo rm Gemfile.Lock&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Make a copy of the &lt;code&gt;.env.sample&lt;/code&gt; file, or whatever you named it, with &lt;code&gt;cp .env.sample .env&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;You can delete the &lt;code&gt;.env.sample&lt;/code&gt; file once you have a copy of it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Edit the file with &lt;code&gt;sudo nano .env&lt;/code&gt;, add in any keys needed for your application and save the file.

&lt;ul&gt;
&lt;li&gt;For example &lt;code&gt;HASH_KEY=SomeSuperSecretRandonString&lt;/code&gt; would be added to the &lt;code&gt;.env&lt;/code&gt; file.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now navigate into the &lt;code&gt;config&lt;/code&gt; folder with &lt;code&gt;cd config&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Here you will run &lt;code&gt;sudo nano master.key&lt;/code&gt; to either edit an existing "key" file or create one.&lt;/li&gt;
&lt;li&gt;Add a key to the file that was previously used.

&lt;ul&gt;
&lt;li&gt;This is only for if you are working with a previously created repository and is specific to it's creation.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Back out into the main "backend" folder and read the &lt;code&gt;.gitignore&lt;/code&gt; file with &lt;code&gt;less .gitignore&lt;/code&gt; to make sure that both the &lt;code&gt;.env&lt;/code&gt; and the &lt;code&gt;master.key&lt;/code&gt; files are listed so they won't be uploaded to GitHub accidently. &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---2R7KGP4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pf9aqui7s0e0m8m2yyaw.png" alt="Sample GitIgnore File"&gt;

&lt;ul&gt;
&lt;li&gt;Mine were in there already but good to double check. Don't want any private folders escaping into the Internets.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now you should be able to run &lt;code&gt;bundle install&lt;/code&gt; to install any needed gem dependencies.

&lt;ul&gt;
&lt;li&gt;You night need to "bundle" things again later so, your call if you care to do this now and/or later.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 3: Adding the Backend Endpoints&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Now that Ruby and Rails are both installed on the server it's time to configure the endpoint for the backend API. This step will be similar to the &lt;a href="https://dev.to/caffiendkitten/a-is-for-apache-3iem#S2-1"&gt;process for the frontend&lt;/a&gt; but you will need to make a few naming modifications.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the Apache2 "sites-available" folder with &lt;code&gt;cd /etc/apache2/sites-available&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Make a copy of the applications "conf" file with a different name by running &lt;code&gt;sudo cp etcpasswdapp.conf etcpasswdapi.conf&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;I recommend making a copy of the frontend "conf" file because we will a lot of the info in it for the backend to be running over HTTPS.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo nano etcpasswdapi.conf&lt;/code&gt; to open up the new file in the nano editor.

&lt;ul&gt;
&lt;li&gt;You will be editing a few things so be sure to leave it open for a bit.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;With the editor open change the first &lt;code&gt;&amp;lt;VirtualHost *:443&amp;gt;&lt;/code&gt; section's "DocumenRoot" to the location of the backends' "public" folder.

&lt;ul&gt;
&lt;li&gt;For example, mine will be &lt;code&gt;/var/www/etcpasswdapp/backend/public&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;With the editor open change the "ServerName" and "ServerAlias" to the API's nameing scheme.

&lt;ul&gt;
&lt;li&gt;For example, my "ServerName" will be &lt;code&gt;api.etcpasswdapp.com&lt;/code&gt; and my "ServerAlias" will be &lt;code&gt;*.etcpassedapp.com&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In the second &lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&lt;/code&gt; section use the same naming scheme and change its "DocumentRoot, "ServerName", and "Redirect" accordingly. &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m8YRFRA1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7cbze418g1bog49dyve7.png" alt="example conf file"&gt;
&lt;/li&gt;
&lt;li&gt;Now save the file and exit the editor.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 4: Adding SSL&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Now that there is an end point you will need to follow the &lt;a href="https://dev.to/caffiendkitten/adding-ssl-to-a-server-28p9#S2"&gt;same process as the frontend&lt;/a&gt; and &lt;a href="https://dev.to/caffiendkitten/adding-ssl-to-a-server-28p9#S1"&gt;configure a new SSL certificate&lt;/a&gt; with different names for the endpoint to work for testing.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create the SSL certificate for the backend with &lt;code&gt;sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache_cert2.key -out /etc/ssl/certs/apache_cert2.crt&lt;/code&gt;. It will prompt you for some basic information about your site. &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yTYE_G4k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/163v1it8f7g651xr1igc.png" alt="Alt Text"&gt;

&lt;ul&gt;
&lt;li&gt;Note: that &lt;code&gt;req&lt;/code&gt; is like "request" with a 'Q' and not a 'G' and you can name the cert anything. I chose the "apache_cert2" because it was convenient for me to type for this project.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now that the certs are generated you need to navigate into the Apache2 "sites-available" folder, if not there already, with &lt;code&gt;cd /etc/apache2/sites-available&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Open the "conf" file for the backend to edit it with &lt;code&gt;sudo nano etcpasswdapi.conf&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add the SSL configuration into the &lt;code&gt;&amp;lt;VirtualHost *:443&amp;gt;&lt;/code&gt; section below the  "DocumentRoot" somewhere. &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fvBdbgMo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t5h3rd1lt17zm1nkvpx3.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Once you have edited the locations of the certs in the first &lt;code&gt;&amp;lt;VirtualHost *:443&amp;gt;&lt;/code&gt; section save the file and exit nano.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You may still get betting the pesky error from the browsers when trying to access the page but you should be able to go into the "Advanced" button and allow the "unsafe site". &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rTz906TV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oekv8ko00o223cfrwkri.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rTz906TV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oekv8ko00o223cfrwkri.png" alt="Site Error"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 5: Configure database.yml and secrets.yml&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Now that the API is on the server, it has an endpoint, and SSL is enabled you now need to configure the applications &lt;code&gt;database.yml&lt;/code&gt; and &lt;code&gt;secrets.yml&lt;/code&gt;/&lt;code&gt;secrets.yml.enc&lt;/code&gt; (depending on your set up) files for the database to work. "As of Rails 5.2, config/secrets.yml, config/secrets.yml.enc and SECRET_BASE_KEY are no longer being used to store encrypted keys. From now on, you are to use these files instead: config/credentials.yml.enc and config/master.key." &lt;sup&gt;11&lt;/sup&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the API's &lt;code&gt;database.yml&lt;/code&gt; file with &lt;code&gt;cd /var/www/etcpasswdapp/backend/config&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo nano master.key&lt;/code&gt; or &lt;code&gt;sudo nano secrects.yml&lt;/code&gt; to create the file, or edit an existing file, and add in your secret to interact with the database in it.

&lt;ul&gt;
&lt;li&gt;In my case I needed to add in a &lt;em&gt;secret string&lt;/em&gt; that I'd previously set up into my &lt;code&gt;master.key&lt;/code&gt; file and made a &lt;code&gt;secrets.yml&lt;/code&gt; file and put the same key that my &lt;code&gt;master.key&lt;/code&gt; file had in it, just to be safe if it's needed. &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QFrrYVS5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xlbie9txfflfsz3dvyds.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Also, this the key not a variable. Just add in the string on the first line all by itself save it. It is case sensitive.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now run &lt;code&gt;sudo nano database.yml&lt;/code&gt; and configure it according to &lt;a href="https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/bionic/deploy_app.html#rails_configure-database-yml-and-secrets-yml"&gt;Passenger's Walkthrough step 2.3&lt;/a&gt;. It will look something like this when done. &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FjQVbOvf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qzori55r2gexn0kblpyu.png" alt="Alt Text"&gt;

&lt;ul&gt;
&lt;li&gt;This will depend a lot on your own set up so take a min with it. (We will be using Passenger in the next section so this will do well.)&lt;/li&gt;
&lt;li&gt;You might need to delete your database configuration if you had set one up previously because it will interfere with Rails' configuration of its database based on the information in the &lt;code&gt;database.yml&lt;/code&gt; file.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now that the database configuration is set up be sure to edit the &lt;code&gt;.gitignore&lt;/code&gt; file again and add in any missing files you don't want on the internet. 

&lt;ul&gt;
&lt;li&gt;For example, I added the &lt;code&gt;database.yml&lt;/code&gt; file because of the password for my development configuration as so. &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--roJjK3Oo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mslc5uug59m3ncum6h81.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If everything works you will hopefully be able to now run &lt;code&gt;rake db:create&lt;/code&gt; to finish setting up the database.&lt;/li&gt;
&lt;li&gt;Hopefully you were able to create the database ok. If so you can now run &lt;code&gt;rake db:migrate&lt;/code&gt; and &lt;code&gt;rake db:seed&lt;/code&gt; to populate your database with the seed data for testing.

&lt;ul&gt;
&lt;li&gt;If you run into an error try running &lt;code&gt;rake db:reset&lt;/code&gt; or try deleting the database in the &lt;code&gt;psql&lt;/code&gt; command line interface and recreating it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;You should now be able to check the configuration of the database within the &lt;code&gt;psql&lt;/code&gt; command line interface and interact with the database. &lt;sup&gt;18&lt;/sup&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;p&gt;Sorry but...&lt;a href="https://i.giphy.com/media/ItjO4QS1WeAjATXrid/giphy-downsized.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/ItjO4QS1WeAjATXrid/giphy-downsized.gif" alt=""&gt;&lt;/a&gt;&lt;br&gt;
There are a few more things to do as I need to set up &lt;a href="https://dev.to/caffiendkitten/building-a-home-test-server-27h1#WebServerVsHTTPServer"&gt;application server&lt;/a&gt; and go through server hardening.&lt;/p&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" alt="Happy Hacking ^_^"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;p&gt;&lt;a&gt;1.&lt;/a&gt; &lt;a href="https://www.postgresql.org/docs/12/tutorial-createdb.html"&gt;https://www.postgresql.org/docs/12/tutorial-createdb.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;2.&lt;/a&gt; &lt;a href="https://www.postgresqltutorial.com/postgresql-data-types/"&gt;https://www.postgresqltutorial.com/postgresql-data-types/&lt;/a&gt;&lt;br&gt;
&lt;a&gt;3.&lt;/a&gt; &lt;a href="https://www.postgresqltutorial.com/postgresql-create-table/"&gt;https://www.postgresqltutorial.com/postgresql-create-table/&lt;/a&gt;&lt;br&gt;
&lt;a&gt;4.&lt;/a&gt; &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-18-04"&gt;https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-18-04&lt;/a&gt;&lt;br&gt;
&lt;a&gt;5.&lt;/a&gt; &lt;a href="https://devhints.io/rbenv"&gt;https://devhints.io/rbenv&lt;/a&gt;&lt;br&gt;
&lt;a&gt;6.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/bionic/install_passenger.html"&gt;https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/bionic/install_passenger.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;7.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/standalone/install/oss/focal.html"&gt;https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/standalone/install/oss/focal.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;8.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/apache/install/oss/focal.html"&gt;https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/apache/install/oss/focal.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;9.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/library/install/apache/working_with_the_apache_config_file.html"&gt;https://www.phusionpassenger.com/library/install/apache/working_with_the_apache_config_file.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;10.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/rubygems_norvm/install_passenger.html#step-2:-run-the-passenger-apache-module-installer"&gt;https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/rubygems_norvm/install_passenger.html#step-2:-run-the-passenger-apache-module-installer&lt;/a&gt;&lt;br&gt;
&lt;a&gt;11.&lt;/a&gt; &lt;a href="https://medium.com/@thorntonbrenden/rails-and-the-legendary-master-key-15c8be7799f1"&gt;https://medium.com/@thorntonbrenden/rails-and-the-legendary-master-key-15c8be7799f1&lt;/a&gt;&lt;br&gt;
&lt;a&gt;12.&lt;/a&gt; &lt;a href="https://linuxize.com/post/how-to-install-ruby-on-ubuntu-20-04/"&gt;https://linuxize.com/post/how-to-install-ruby-on-ubuntu-20-04/&lt;/a&gt;&lt;br&gt;
&lt;a&gt;13.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/apache/working_with_the_apache_config_file.html"&gt;https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/apache/working_with_the_apache_config_file.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;14.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/docs/tutorials/deploy_to_production/deploying_your_app/oss/aws/ruby/apache/#rails_configure-database-yml-and-secrets-yml"&gt;https://www.phusionpassenger.com/docs/tutorials/deploy_to_production/deploying_your_app/oss/aws/ruby/apache/#rails_configure-database-yml-and-secrets-yml&lt;/a&gt;&lt;br&gt;
&lt;a&gt;15.&lt;/a&gt; &lt;a href="https://www.phusionpassenger.com/library/walkthroughs/start/ruby.html"&gt;https://www.phusionpassenger.com/library/walkthroughs/start/ruby.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;16.&lt;/a&gt; &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-use-postgresql-with-your-ruby-on-rails-application-on-ubuntu-18-04"&gt;https://www.digitalocean.com/community/tutorials/how-to-use-postgresql-with-your-ruby-on-rails-application-on-ubuntu-18-04&lt;/a&gt;&lt;br&gt;
&lt;a&gt;17.&lt;/a&gt; &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-a-ruby-on-rails-project-with-a-react-frontend"&gt;https://www.digitalocean.com/community/tutorials/how-to-set-up-a-ruby-on-rails-project-with-a-react-frontend&lt;/a&gt;&lt;br&gt;
&lt;a&gt;18.&lt;/a&gt; &lt;a href="http://postgresguide.com/utilities/psql.html"&gt;http://postgresguide.com/utilities/psql.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;19.&lt;/a&gt; &lt;a href="https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/autoconf.html#Introduction"&gt;https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/autoconf.html#Introduction&lt;/a&gt;&lt;br&gt;
&lt;a&gt;20.&lt;/a&gt; &lt;a href="https://www.gnu.org/software/bison/manual/bison.html#Introduction"&gt;https://www.gnu.org/software/bison/manual/bison.html#Introduction&lt;/a&gt;&lt;br&gt;
&lt;a&gt;21.&lt;/a&gt; &lt;a href="https://linuxize.com/post/how-to-install-gcc-on-ubuntu-20-04/#:%7E:text=The%20default%20Ubuntu%20repositories%20contain,tools%20required%20for%20compiling%20software"&gt;https://linuxize.com/post/how-to-install-gcc-on-ubuntu-20-04/#:~:text=The%20default%20Ubuntu%20repositories%20contain,tools%20required%20for%20compiling%20software&lt;/a&gt;.&lt;br&gt;
&lt;a&gt;22.&lt;/a&gt; &lt;a href="https://packages.debian.org/jessie/libssl-dev"&gt;https://packages.debian.org/jessie/libssl-dev&lt;/a&gt;&lt;br&gt;
&lt;a&gt;23.&lt;/a&gt; &lt;a href="https://packages.debian.org/buster/libyaml-dev"&gt;https://packages.debian.org/buster/libyaml-dev&lt;/a&gt;&lt;br&gt;
&lt;a&gt;24.&lt;/a&gt; &lt;a href="https://packages.debian.org/buster/libreadline-dev"&gt;https://packages.debian.org/buster/libreadline-dev&lt;/a&gt;&lt;br&gt;
&lt;a&gt;25.&lt;/a&gt; &lt;a href="https://packages.debian.org/buster/zlib1g"&gt;https://packages.debian.org/buster/zlib1g&lt;/a&gt;&lt;br&gt;
&lt;a&gt;26.&lt;/a&gt; &lt;a href="https://packages.debian.org/buster/libncurses5"&gt;https://packages.debian.org/buster/libncurses5&lt;/a&gt;&lt;br&gt;
&lt;a&gt;27.&lt;/a&gt; &lt;a href="https://packages.debian.org/buster/libffi-dev"&gt;https://packages.debian.org/buster/libffi-dev&lt;/a&gt;&lt;br&gt;
&lt;a&gt;28.&lt;/a&gt; &lt;a href="https://packages.debian.org/buster/libgdbm6"&gt;https://packages.debian.org/buster/libgdbm6&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  Please Note: that I am still learning and if something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
  
&lt;/h5&gt;

</description>
      <category>codenewbie</category>
      <category>todayilearned</category>
      <category>sideprojects</category>
      <category>security</category>
    </item>
    <item>
      <title>Adding SSL to a Server</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Tue, 05 Jan 2021 03:01:44 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/adding-ssl-to-a-server-28p9</link>
      <guid>https://dev.to/caffiendkitten/adding-ssl-to-a-server-28p9</guid>
      <description>&lt;p&gt;Welcome Back!&lt;br&gt;
&lt;a href="https://i.giphy.com/media/1oGnXhZlPPzNhyGjAL/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/1oGnXhZlPPzNhyGjAL/giphy.gif" alt="Oh Hi, Hello"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you've kept up till now with this series your application is hopefully/mostly functional on your home server with Heroku hosting its' backend API but you keep getting an error of &lt;code&gt;"net::ERR_CERT_COMMON_NAME_INVALID"&lt;/code&gt; or &lt;code&gt;"net::ERR_CERT_AUTHORITY_INVALID"&lt;/code&gt;.&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpljymidfbzzjspnwrhvr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpljymidfbzzjspnwrhvr.png" alt="server error"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fear not! This is a pretty common SSL error during the loading of a website that, in most cases, is due to certificate misconfiguration on a server or lack of a certificate on a server.&lt;/p&gt;

&lt;p&gt;At this point of this process this error actually makes since because&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I actually haven't configured any SLL yet.&lt;/li&gt;
&lt;li&gt;A new server is not automatically configured to have a HTTPS certificate.&lt;/li&gt;
&lt;li&gt;Specific to my case, this error occurs because I am pointing my local DNS to the generic herokuapp.com Heroku endpoint, which is not able to be certified for my local server.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To fix this error we have a few things we could do: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create our own self-signed Certificate and configure Heroku to accept it specifically for testing.&lt;/li&gt;
&lt;li&gt;Use the SSL host name provided by Heroku for purchase: "herokudns.com" or "herokussl.com" depending on your setup.&lt;/li&gt;
&lt;li&gt;Get a Certificate from a &lt;a href="https://dev.to/caffiendkitten/building-a-home-test-server-27h1#TLSandSSL"&gt;Trusted Certificate Authority&lt;/a&gt;; which is very similar to the Heroku specific SSL host names, but through different third parties.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For this part of the series I will be showing how I created my own self-signed certificate on my server that I will be using when I set up my backend API in the next part of this series.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Table Of Contents&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Step 1: Adding SSL Module and Creating the Certificate&lt;br&gt;
Step 2: Configuring Apache to Use SSL&lt;/p&gt;

&lt;p&gt;So you want to create your own &lt;a href="https://dev.to/caffiendkitten/building-a-home-test-server-27h1#TLSandSSL"&gt;Certificate&lt;/a&gt; and configure it for testing. It's great to lean about how this is done as certificates are and important part of the encryption process of HTTPS. It should be noted that there is some not-so-pretty math involved with encryption and should really be left to the experts in a production environment; so take this all with a grain of salt as I am no encryption expert. &lt;a href="https://i.giphy.com/media/bjyrjdovB7pkc/giphy-downsized.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/bjyrjdovB7pkc/giphy-downsized.gif" alt="Grain of salt shot"&gt;&lt;/a&gt; As for me, I am just curious to see how a general certificate is made and signed so here is how I did it and the &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-20-04" rel="noopener noreferrer"&gt;tutorial&lt;/a&gt; I used to get around configuring Heroku.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 1: Adding SSL Module and Creating the Certificate&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;By following the &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04" rel="noopener noreferrer"&gt;DigitalOcean tutorials&lt;/a&gt; previously, I already have some things set up so I can jump right into Step #1 of the &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-20-04" rel="noopener noreferrer"&gt;tutorial&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enable &lt;code&gt;mod_ssl&lt;/code&gt; module on Apache by running the command &lt;code&gt;sudo a2enmod ssl&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;mod_ssl&lt;/code&gt; is an Apache module that provides support for SSL encryption.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Restart the Apache Service on the server with &lt;code&gt;sudo systemctl restart apache2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Create the SSL certificate by running &lt;code&gt;sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt&lt;/code&gt;. Once run this command will prompt you for some basic information about your site/company like this image. &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F163v1it8f7g651xr1igc.png" alt="Alt Text"&gt;

&lt;ul&gt;
&lt;li&gt;You can name the cert anything but I was following the tutorial so I left it as "apache-selfsigned".&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;req&lt;/code&gt; flag is like "request" with a 'Q' and not a 'G'. This caught me up when setting up mine.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 2: Configuring Apache to Use SSL&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Now that the Apache module is enabled and the certificate is created Apache needs to be configured to use SSL. To do this you will need to modify the application's &lt;code&gt;conf&lt;/code&gt; file and redirecting any HTTP requests to HTTPS.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;sudo nano /etc/apache2/sites-enabled/etcpasswdapp.conf&lt;/code&gt; to open the apps &lt;code&gt;conf&lt;/code&gt; file for editing.&lt;/li&gt;
&lt;li&gt;Add the SSL configuration to the file below the "DocumentRoot" section. Yours will look similar as the image below, but with whatever you named your cert. &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fi3x0y6awzi2yd9eaqq95.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;While still in the &lt;code&gt;conf&lt;/code&gt; file add in a second &lt;code&gt;&amp;lt;VirtualHost&amp;gt;&lt;/code&gt; at the bottom to separate out requests for HTTPS requests on port 443 and HTTP requests on port 80. As shown below, you can see that the second &lt;code&gt;&amp;lt;VirtualHost&amp;gt;&lt;/code&gt; for port 80 has a redirect option in it that will take any traffic from an HTTP request to your site and redirect it to the HTTPS address. &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhaq5xpaxrimy6415vwi9.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Save the file and exit the editor.&lt;/li&gt;
&lt;li&gt;Restart the Apache service by running &lt;code&gt;systemctl restart apache2&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After all this is set up you still might have some issues with your browser giving you an error about the site being self-signed and is not safe. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5pecxl0leeilw879osnn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5pecxl0leeilw879osnn.png" alt="Alt Text"&gt;&lt;/a&gt; This is bad for a production site but for development it's fine for now because the only way to fix this is to get a official signed certificate for a Certificate Authority like &lt;a href="https://www.cloudflare.com/ssl/" rel="noopener noreferrer"&gt;Cloudflare&lt;/a&gt;. To get around this now click on the "advanced" and tell the browser you are in that it is safe.&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  Up Next...
&lt;/h1&gt;

&lt;p&gt;Now with the app functional with Heroku hosting its API, it's now time to migrate the API and database into the server.&lt;/p&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgsiwm8b52w3ci2sn5b3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgsiwm8b52w3ci2sn5b3.gif" alt="Happy Hacking ^_^"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;p&gt;&lt;a&gt;1.&lt;/a&gt; &lt;a href="https://create-react-app.dev/docs/deployment/#static-server" rel="noopener noreferrer"&gt;https://create-react-app.dev/docs/deployment/#static-server&lt;/a&gt;&lt;br&gt;
&lt;a&gt;2.&lt;/a&gt; &lt;a href="https://stackoverflow.com/questions/42308879/how-to-solve-npm-error-npm-err-code-elifecycle" rel="noopener noreferrer"&gt;https://stackoverflow.com/questions/42308879/how-to-solve-npm-error-npm-err-code-elifecycle&lt;/a&gt;&lt;br&gt;
&lt;a&gt;3.&lt;/a&gt; &lt;a href="https://create-react-app.dev/docs/deployment/#customizing-environment-variables-for-arbitrary-build-environments" rel="noopener noreferrer"&gt;https://create-react-app.dev/docs/deployment/#customizing-environment-variables-for-arbitrary-build-environments&lt;/a&gt;&lt;br&gt;
&lt;a&gt;4.&lt;/a&gt; &lt;a href="https://serverless-stack.com/chapters/environments-in-create-react-app.html" rel="noopener noreferrer"&gt;https://serverless-stack.com/chapters/environments-in-create-react-app.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;5.&lt;/a&gt; &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04" rel="noopener noreferrer"&gt;https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04&lt;/a&gt;&lt;br&gt;
&lt;a&gt;6.&lt;/a&gt; &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-20-04" rel="noopener noreferrer"&gt;https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-20-04&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  Please Note: that I am still learning and if something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
  
&lt;/h5&gt;

</description>
      <category>codenewbie</category>
      <category>todayilearned</category>
      <category>sideprojects</category>
      <category>security</category>
    </item>
    <item>
      <title>Adding React to a Server</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Fri, 01 Jan 2021 01:36:21 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/adding-react-to-a-server-nm6</link>
      <guid>https://dev.to/caffiendkitten/adding-react-to-a-server-nm6</guid>
      <description>&lt;p&gt;So you built a home server and now you want to put a web site there to test. You are in the right place.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhe5us10tt7f0jdz5mmdi.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhe5us10tt7f0jdz5mmdi.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I last left off with this series I finished setting up a basic LMAP software stack to host a website/application and at this intersection there are a few paths that you could follow to deploy you application on your LAMP server:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You could download an repository containing an applications source files and configure it directly on the server.&lt;/li&gt;
&lt;li&gt;You could set up a &lt;a href="https://dev.to/caffiendkitten/building-a-home-test-server-27h1#CMS"&gt;Content Management System (CMS)&lt;/a&gt; and build an application through a graphical interface.&lt;/li&gt;
&lt;li&gt;You could build something from scratch on the server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For this part of the project I will be downloading the source files for an application that I built previously and deploy that from the server.&lt;br&gt;
The files are located on GitHub and my local client computer so I will go over two ways that you can download them: with SSH and from GitHub.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Table Of Contents&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Step 1: Setting up Separate Folders for the Frontend and Backend&lt;br&gt;
Step 2: Downloading an application repository&lt;br&gt;
Step 3: The React Configuration&lt;br&gt;
Step 4: Configure the Environment Variables&lt;br&gt;
Step 5: Clearing the Cache&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 1: Setting up Separate Folders for the Frontend and Backend&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;This step is used if you are using SSH to get the application's files or if you are creating an application from scratch.&lt;/p&gt;

&lt;p&gt;First thing I recommend doing is setting up the folders for the frontend to live in. You could also create a "backend" folder at this point but I will wait and create it when I need it later in this series.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If not already there, run &lt;code&gt;cd /var/www/etcpasswdapp&lt;/code&gt; to navigate into the application's folder.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo mkdir frontend&lt;/code&gt; to create a separate folder for the frontend.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 2: Downloading an application repository&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Now we need to get the application files onto the server and there are a few ways that it can be done. If you system allows a USB you could copy the files onto a USB and then into the applications folder, use git to download the files from GitHub, or use SSH to download the files from your client computer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With SSH&lt;/strong&gt;&lt;br&gt;
To get this step done I need to be able to download the files from my client computer through a Command Line Interface. This is easy enough because during the Ubuntu Server install SSH was installed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You can confirm that you have SSH installed already by running &lt;code&gt;systemctl status ssh&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;If you don't have SSH for the Ubuntu server you might need to run &lt;code&gt;sudo apt install ssh&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Ensure that "Port 22" is open on your server computer to interact with it run &lt;code&gt;sudo ufw status&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;If "Port 22" isn't open already (probably not) you will need to run &lt;code&gt;sudo ufw allow 22&lt;/code&gt; to open the Port with the &lt;a href="https://dev.to/caffiendkitten/building-a-home-test-server-27h1#UNFW"&gt;Uncomplicated Firewall (ufw)&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Ensure that the SSH service is running on the server computer by running &lt;code&gt;sudo service ssh start&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Now on the client computer open the "PowerShell" CLI as Admin and navigate to whatever folder your application is in. For me I have to  run &lt;code&gt;cd ../../Users\meeeeee\Documents\Development&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;Be sure to choose the correct folder for YOUR system. This took me a minute to find the right folder in my system and "meeeeee" is just a name I threw in for an example.&lt;/li&gt;
&lt;li&gt;I'm also not sure if Admin status is really needed but I did it just to be safe.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Once in the folder run &lt;code&gt;scp -r .\Final-Project-Frontend\* dan@192.168.2.43:/home/dan/&lt;/code&gt; (but specific to your set up) &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fa1vijmipon4931th9xbx.png" alt="scp command"&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;scp&lt;/code&gt; is the &lt;a href="https://dev.to/caffiendkitten/building-a-home-test-server-27h1#SSHandSCP"&gt;Secure Copy Protocol&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-r&lt;/code&gt; is the flag to perform a recursive action on anything in the folder.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.\Final-Project-Frontend\&lt;/code&gt; is the folder where my application is located within my Development folder on my client computer.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;*&lt;/code&gt; is added to mean everything in the folder's folders and not just files.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;dan@192.168.2.43:/home/dan/&lt;/code&gt; is the SSH command to connect to my server computer and the file where you want your files put.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Back on the server computer ensure that you are in your main defualt folder with the &lt;code&gt;cd&lt;/code&gt; command.

&lt;ul&gt;
&lt;li&gt;FYI, the main default folder is the one that you appear in when you log into the server; usually the &lt;code&gt;/home/your_name_here&lt;/code&gt; folder.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now that the application files are in your server you can move them from the main default folder into the &lt;code&gt;/etcpasswdapp/frontend&lt;/code&gt; folder with &lt;code&gt;cp -r * /var/www/etcpasswdapp/frontend&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cp&lt;/code&gt; is the command for "copy".&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-r&lt;/code&gt; will recursively move everything in the folder you are currently in (hopefully your main default folder) into the applications main folder.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now that the application files are moved I recommend deleting the old files. To do this run &lt;code&gt;rm -r &amp;lt;folder_name&amp;gt;&lt;/code&gt; and &lt;code&gt;rm &amp;lt;file_name&amp;gt;&lt;/code&gt; for each folder and file individually so as to not accidently delete something you wanted to keep. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;With Git&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First install &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noopener noreferrer"&gt;git&lt;/a&gt; onto the server computer with &lt;code&gt;sudo apt install git&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You will need to configure your git identity on the server by running both &lt;code&gt;git config --global user.name "Your GitHub username"&lt;/code&gt; and &lt;code&gt;git config --global user.email YourGitHubEmail@example.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Now, navigate into the folder your application will live in with &lt;code&gt;cd /var/www/etcpasswdapp&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Before you clone the GitHub repository you will need to delete the folders you created in step #1 with &lt;code&gt;sudo rm -rf frontend&lt;/code&gt;. This will recursively remove the etcpasswdapp's frontend folder.&lt;/li&gt;
&lt;li&gt;Now run &lt;code&gt;sudo git clone https://github.com/yourGitHubProject.git frontend&lt;/code&gt; to clone the repository into a new folder called &lt;code&gt;frontend&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Now run &lt;code&gt;cd /var/www/etcpasswdapp/frontend&lt;/code&gt; and you should see the files you downloaded and if you run &lt;code&gt;git status&lt;/code&gt; you can see that you are linked up to GitHub for some great version control and backup ability of your application.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 3: The React Configuration&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Now that the application is in the correct folder on the server it's time to add the React configuration into Apache; which really is installing the &lt;a href="https://www.npmjs.com/" rel="noopener noreferrer"&gt;NPM package manager&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First thing is to navigate into the apache config folder for the application with &lt;code&gt;cd /etc/apache2/sites-enabled&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo nano etcpasswdapp.conf&lt;/code&gt; to edit the VirtualHost configuration for the application.&lt;/li&gt;
&lt;li&gt;Edit the "DocumentRoot" line to the new location of the landing page (&lt;code&gt;/var/www/etcpasswdapp/frontend/build&lt;/code&gt;)and the "Directory" path to the application's main folder (&lt;code&gt;/var/www/etcpasswdapp/&lt;/code&gt;). &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftwdkroiuvgheqx686j6x.png" alt="VirtualHost Changes Example"&gt;

&lt;ul&gt;
&lt;li&gt;Note: At this time your site might show you an error on your client computer because, like mine, the build folder is probably not be configured right yet. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Install the npm module with &lt;code&gt;sudo apt install npm&lt;/code&gt; to allow for the creation of the "production build" for your application.&lt;/li&gt;
&lt;li&gt;Navigate to the application's folder with &lt;code&gt;cd /var/www/etcpasswdapp/frontend&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo npm install&lt;/code&gt; to make sure all the packages are installed.

&lt;ul&gt;
&lt;li&gt;Add the &lt;code&gt;-g&lt;/code&gt; flag at the end to install npm globally.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If you have any .env files ensure that they are up to date. (See step $4 below)&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo npm run build&lt;/code&gt; to create the production build folder.

&lt;ul&gt;
&lt;li&gt;If you run into an error here where the "build" fails refer to step #5 below for Clearing the Cache and try again.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now that npm is installed you might need to restart the Apache service but you shouldn't need to run &lt;code&gt;sudo npm run start&lt;/code&gt; because the Apache web server is already running and this command is for starting a separate "server instance" that isn't needed for this type of set up.&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 4: Configure the Environment Variables&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Environment variables are important to hold secrets for the application as well as tell the application to run in a "production" mode or "development" mode (which is important for testing).&lt;br&gt;
You might not need this step if you are creating an application from scratch or coping the application files from the client computer. However, if you downloaded a GitHub repository then you will need to create an &lt;code&gt;.env&lt;/code&gt; file and a &lt;code&gt;.gitignore&lt;/code&gt; file and configure them for security of the application.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ensure you are in the applications folder and run &lt;code&gt;sudo nano .env&lt;/code&gt; to create &amp;amp; edit the &lt;code&gt;.env&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Add any needed variables with the "REACT_APP_" prefix or rename any existing variables to have "REACT_APP_" before all variables you will need.

&lt;ul&gt;
&lt;li&gt;For example, if you had a variable such as &lt;code&gt;CRYPT_KEY&lt;/code&gt; it needs be be changed to &lt;code&gt;REACT_APP_CRYPT_KEY&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Save the file and exit the editor.&lt;/li&gt;
&lt;li&gt;Edit any location where the variables are used and add "process.env" in front of each variable. 

&lt;ul&gt;
&lt;li&gt;For example, in my "app.js" file any &lt;code&gt;CRYPT_KEY&lt;/code&gt; variable becomes &lt;code&gt;process.env.REACT_APP_CRYPT_KEY&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now delete any of the old variable creations throughout the application's files.

&lt;ul&gt;
&lt;li&gt;For example, at the top of my "app.js" file I will delete a bunch of constants that I created for local testing of the API location, like &lt;code&gt;const CRYPT_KEY = "http://localhost:3000/api/v1/login"&lt;/code&gt;. No need to keep extra code around.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo .gitignore&lt;/code&gt; to create &amp;amp; edit a .gitignore file that GitHub will use to know which files will not be added to GitHub.

&lt;ul&gt;
&lt;li&gt;For example: add the &lt;code&gt;.env&lt;/code&gt; file to that &lt;code&gt;.gitignore&lt;/code&gt; file so it doesn't accidently get loaded onto GitHub.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add any files with their path to the file&lt;/li&gt;
&lt;li&gt;Save the file and exit the editor.&lt;/li&gt;
&lt;li&gt;I recommend you rerun the &lt;code&gt;npm run build&lt;/code&gt; command here to reconfigure your build to the new variables and the new files.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 5: Clearing the Cache&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;So your build failed. Mine failed a few times during this process and the best thing to try is to clear the cache, delete the npm packages for the application, and re-build it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If not already there, run &lt;code&gt;cd /var/www/etcpasswdapp&lt;/code&gt; to navigate into the application's folder.

&lt;ul&gt;
&lt;li&gt;This step needs to be done from within the application's folder.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo npm cache clean --force&lt;/code&gt; to force the clearing any cache the application might have.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo rm -rf node_modules package-lock.json&lt;/code&gt; to delete the "node_modules" folder and the "package-lock.json" file.

&lt;ul&gt;
&lt;li&gt;Or delete each separately by running &lt;code&gt;sudo rm -rf node_modules&lt;/code&gt; and &lt;code&gt;sudo rm -rf package-lock.json&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Install the npm packages again with &lt;code&gt;sudo npm install&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Ensure npm is started with &lt;code&gt;sudo npm start&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npm run build&lt;/code&gt; again and hopefully your application will be working now.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;p&gt;At this point the applications frontend should be working. For my system I have my backend still on Heroku so my links are not broken BUT the backend is not working because I have not set up SSL on the frontend yet. &lt;/p&gt;

&lt;h2&gt;
  
  
  Up Next... Securing Server Traffic with SSL
&lt;/h2&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgsiwm8b52w3ci2sn5b3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgsiwm8b52w3ci2sn5b3.gif" alt="Happy Hacking ^_^"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;p&gt;&lt;a&gt;1.&lt;/a&gt; &lt;a href="https://create-react-app.dev/docs/deployment/#static-server" rel="noopener noreferrer"&gt;https://create-react-app.dev/docs/deployment/#static-server&lt;/a&gt;&lt;br&gt;
&lt;a&gt;2.&lt;/a&gt; &lt;a href="https://stackoverflow.com/questions/42308879/how-to-solve-npm-error-npm-err-code-elifecycle" rel="noopener noreferrer"&gt;https://stackoverflow.com/questions/42308879/how-to-solve-npm-error-npm-err-code-elifecycle&lt;/a&gt;&lt;br&gt;
&lt;a&gt;3.&lt;/a&gt; &lt;a href="https://create-react-app.dev/docs/deployment/#customizing-environment-variables-for-arbitrary-build-environments" rel="noopener noreferrer"&gt;https://create-react-app.dev/docs/deployment/#customizing-environment-variables-for-arbitrary-build-environments&lt;/a&gt;&lt;br&gt;
&lt;a&gt;4.&lt;/a&gt; &lt;a href="https://serverless-stack.com/chapters/environments-in-create-react-app.html" rel="noopener noreferrer"&gt;https://serverless-stack.com/chapters/environments-in-create-react-app.html&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  Please Note: that I am still learning and if something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
  
&lt;/h5&gt;

</description>
      <category>codenewbie</category>
      <category>todayilearned</category>
      <category>sideprojects</category>
      <category>security</category>
    </item>
    <item>
      <title>"P" is for PHP</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Fri, 25 Dec 2020 00:16:54 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/p-is-for-php-1d7l</link>
      <guid>https://dev.to/caffiendkitten/p-is-for-php-1d7l</guid>
      <description>&lt;p&gt;When I last left off I had just finished the PostgreSQL database install and basic configuration so now it's time for the "P" in the LAMP stack, PHP. The "P" in LAMP technically represents "PHP" (PHP: Hypertext Preprocessor); though like MySQL, PHP has also been substituted for other server-side scripting languages in recent years; such as, Perl, and Python. &lt;/p&gt;

&lt;p&gt;[⭕]Linux&lt;br&gt;
[⭕]Apache&lt;br&gt;
[⭕]&lt;del&gt;MySQL&lt;/del&gt; PostgreSQL&lt;br&gt;
[❌]&lt;strong&gt;PHP&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PHP is an server-side scripting language, and general purpose programming language, that can be deployed on most web servers, works on almost every operating system and platform, and is free to use. It was created in 1994 and in spite of its historical security issues it has been widely ported and remains popular for its ability to efficiency process code and create dynamic web content on/for a web server. &lt;sup&gt;4&lt;/sup&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hJl-5VjG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Webysther_20160423_-_Elephpant.svg/200px-Webysther_20160423_-_Elephpant.svg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hJl-5VjG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Webysther_20160423_-_Elephpant.svg/200px-Webysther_20160423_-_Elephpant.svg.png" alt="PHP"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When building a dynamic website/application PHP commands are either embedded directly into HTML source code or in external files that are linked to. When a web server gets a request for a PHP file, like &lt;code&gt;index.php&lt;/code&gt;, or encounters a link to an external PHP file in an HTML file, like &lt;code&gt;index.html&lt;/code&gt;, the web server passes that part of the request to a PHP interpreter. The PHP interpreter will read the file and execute any PHP code it finds. Once done interpreting the file the output of the code will be passed back to the web server which will then send the dynamically created content back to the client/browser that made the original request. &lt;/p&gt;

&lt;p&gt;This all means that any PHP code that is run will not be visible to the user making a request but instead will be run by/on the web server and will result in a dynamically created HTML document that will be visible to the user. &lt;sup&gt;3&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CE1Hw30X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/civwq0g4l7hm05l3l9kk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CE1Hw30X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/civwq0g4l7hm05l3l9kk.png" alt="LAMPhp location"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;a&gt;Table Of Contents&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Step 1: Installing PHP&lt;br&gt;
Step 2: Testing PHP&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;a&gt;Step 1: Installing PHP&lt;/a&gt;
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;To install the PHP module run &lt;code&gt;sudo apt install php libapache2-mod-php php-pgsql&lt;/code&gt;. 

&lt;ul&gt;
&lt;li&gt;This will install the PHP module with 2 dependencies of the PHP module for Apache and the PHP PostgreSQL connector.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sudo apt install&lt;/code&gt; is the command to install something on Ubuntu.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;php&lt;/code&gt; is the thing that is being installed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;libapache2-mod-php&lt;/code&gt; is the apache2 PHP module dependency.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;php-pgsql&lt;/code&gt; is the PostgreSQL module for PHP dependency.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Restart the apache2 service with &lt;code&gt;systemctl restart apache&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;a&gt;Step 2: Testing PHP&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;That's it. There is no configuring PHP. The set up is done but you need to test it to ensure that it is working.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate into the "etcpasswdapp" site folder with &lt;code&gt;cd /var/www/etcpasswdapp/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Make a new PHP index file with &lt;code&gt;nano index.php&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;This will also open up the "nano" editor.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Edit the "index.php"  file by adding some simple PHP code to the file such as:&lt;br&gt;
&lt;/p&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;Example&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

    &amp;lt;?php
        echo phpinfo();
    ?&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;
or &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qgLvZ-SN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cw5dteet0ijlc1vo20af.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qgLvZ-SN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cw5dteet0ijlc1vo20af.png" alt="Example PHP page"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Save the file and exit the editor.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the client computer navigate to the address of the PHP file such as "etcpasswdapp.com/index.php" and notice that there is now the PHP in the page. Below you can see the output of my &lt;code&gt;phpinfo()&lt;/code&gt; command from my server computer.  &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---G0nDmNf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7c2tv5w56eu4pbzyu8uz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---G0nDmNf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7c2tv5w56eu4pbzyu8uz.png" alt="phpinfos"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Notice that I didn't delete my &lt;code&gt;index.html&lt;/code&gt; page but instead am able to call the &lt;code&gt;index.php&lt;/code&gt; in place of it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice that if you view the "source code" in the browser that you don't see the simple PHP page that I created by instead the dynamically created HTML output of the command in the next picture. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ch_g5_tO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/suj18cfwz7lu4jb4hmkv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ch_g5_tO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/suj18cfwz7lu4jb4hmkv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;



&lt;br&gt;
DONE!! Now that the LAMP stack is installed and has some basic configurations it's time to move to setting up your website. For this I will be setting up the React frontend separate from the Ruby on Rails API backend and setting up their SSL configuration and then hardening the server itself.

&lt;p&gt;[⭕]Linux&lt;br&gt;
[⭕]Apache&lt;br&gt;
[⭕]&lt;del&gt;MySQL&lt;/del&gt; PostgreSQL&lt;br&gt;
[⭕]&lt;strong&gt;PHP&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" alt="Happy Hacking ^_^"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;p&gt;&lt;a&gt;1.&lt;/a&gt; &lt;a href="https://create-react-app.dev/docs/deployment/"&gt;https://create-react-app.dev/docs/deployment/&lt;/a&gt;&lt;br&gt;
&lt;a&gt;2.&lt;/a&gt; &lt;a href="https://www.ibm.com/cloud/learn/lamp-stack-explained"&gt;https://www.ibm.com/cloud/learn/lamp-stack-explained&lt;/a&gt;&lt;br&gt;
&lt;a&gt;3.&lt;/a&gt; &lt;a href="https://stillat.com/blog/2014/04/02/how-does-php-work-with-the-web-server-and-browser"&gt;https://stillat.com/blog/2014/04/02/how-does-php-work-with-the-web-server-and-browser&lt;/a&gt;&lt;br&gt;
&lt;a&gt;4.&lt;/a&gt; &lt;a href="https://en.wikipedia.org/wiki/PHP"&gt;https://en.wikipedia.org/wiki/PHP&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  Please Note: that I am still learning and if something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
  
&lt;/h5&gt;

</description>
      <category>codenewbie</category>
      <category>todayilearned</category>
      <category>sideprojects</category>
      <category>security</category>
    </item>
    <item>
      <title>"M" is for MySQL</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Fri, 25 Dec 2020 00:16:22 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/m-is-for-mysql-3a9j</link>
      <guid>https://dev.to/caffiendkitten/m-is-for-mysql-3a9j</guid>
      <description>&lt;p&gt;When I last left off I had just finished the Apache HTTP server install and basic configuration so now it's time for the "M" in LAMP, &lt;del&gt;MySql&lt;/del&gt; PostgreSQL. The "M" in the LAMP stack technically represents "MySQL", an open-source relational database management system (RDBMS), but in recent years has expanded to include any RDBMS that fits your needs; such as MariaDB or PostgreSQL, or even NoSQL databases such as MongoDB.&lt;/p&gt;

&lt;p&gt;For my "M" I chose to use PostgreSQL because it has a strong reputation for its reliability, flexibility, support of open technical standards, and its use of both non-relational and relational data types. That being said, there are a lot of options for databases anymore so it's important to do your own research and find one that you are comfortable with and does what you need. (Reference link 2 is a list of RDBMS that you might look at and link 3 is information on choosing a database.)&lt;/p&gt;

&lt;p&gt;[⭕]Linux&lt;br&gt;
[⭕]Apache&lt;br&gt;
[❌]&lt;strong&gt;MySQL&lt;/strong&gt;&lt;br&gt;
[❌]PHP&lt;/p&gt;

&lt;p&gt;PostgreSQL is an open source Object-RDMBS (Relational Database Management Systems) that uses a client/server model. As with other client/server applications, the client and server can be on different hosts, or the same host, and they communicate over a TCP/IP network connection. &lt;sup&gt;5&lt;/sup&gt; PostgreSQL became popular for its ACID-compliance (Atomicity, Consistency, Isolation, Durability) and support of both non-relational and relational data types.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B861W5FO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://computingforgeeks.com/wp-content/uploads/2018/11/Install-PostgreSQL-11-Fedora-29-min.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B861W5FO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://computingforgeeks.com/wp-content/uploads/2018/11/Install-PostgreSQL-11-Fedora-29-min.jpg" alt="PostgreSQL"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Table Of Contents&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Step 1: Installing PostgreSQL&lt;br&gt;
Step 2: Configuring PostgreSQL&lt;br&gt;
Step 3: The Database&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 1:  Installing PostgreSQL&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Like other installs PostgreSQL is pretty straight forward to install.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;sudo apt install postgresql postgresql-contrib libpq&lt;/code&gt; to install a PostgreSQL in the Ubuntu server along with some commonly used add-ons for it. &lt;sup&gt;8&lt;/sup&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;postgresql&lt;/code&gt; is to install PostgreSQL &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;postgresql-contrib&lt;/code&gt; is to install additional supplied modules specific to a package&lt;/li&gt;
&lt;li&gt;`libpq1 is to install libraries and headers for C language frontend development &lt;sup&gt;7&lt;/sup&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The install is seriously that easy and if you want to see a list of additional addon package flags available run &lt;code&gt;apt-cache search postgres&lt;/code&gt;. I recommend adding on &lt;code&gt;&amp;gt; list.txt&lt;/code&gt; to the end of the search command to export the list to a file called "list.txt" so that you can actually read over it.&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 2: Configuring PostgreSQL&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;At this point there are a few things that are good to know about Postgres:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Postgres uses a concept called “roles” to handle authentication/authorization and upon installation, Postgres uses the "ident authentication" for any connections from the same machine. This means that it associates Postgres roles with a matching Unix/Linux system account and if a role exists within Postgres, a Unix/Linux username with the same name is able to sign in as that role. &lt;sup&gt;4&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;Postgres authentication system assumes that for any role used to log into it, that role will have a database with the same name that it can access. This means that if a user is created with the &lt;code&gt;sudo -u postgres createuser --interactive&lt;/code&gt; command called "dan", that the role will attempt to connect to a database which is also called “dan” by default and if this database isn't created then it needs to be for that user role to interact with Postgres properly.&lt;/li&gt;
&lt;li&gt;"Each table is a named collection of &lt;em&gt;rows&lt;/em&gt;. Each row of a given table has the same set of named &lt;em&gt;columns&lt;/em&gt;, and each column is of a specific data type. Whereas columns have a fixed order in each row, it is important to remember that SQL does not guarantee the order of the rows within the table in any way (although they can be explicitly sorted for display)." &lt;sup&gt;6&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;"Tables are grouped into databases, and a collection of databases managed by a single PostgreSQL server instance constitutes a database &lt;em&gt;cluster&lt;/em&gt;." &lt;sup&gt;6&lt;/sup&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Now that that is out of the way PostgreSQL needs to be configured.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Switch over to the default Postgres account with &lt;code&gt;sudo -i -u postgres&lt;/code&gt; and notice that your terminal now shows "postgres@homeserver:$", or whatever you named your server, instead of "root@homeserver:$".

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;sudo&lt;/code&gt; does need to be used for this command even if you are logged in as root already.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Create a new Postgres specific user role with &lt;code&gt;createuser --interactive&lt;/code&gt;.&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g2DPJkGc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/nl3evex4s46xpnybjo3z.png" alt="Alt Text"&gt;

&lt;ul&gt;
&lt;li&gt;The "--interactive" flag will enable a prompt for the name and role you want to add.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;sudo -u postgres createuser --interactive&lt;/code&gt; command can be run a root to do the same thing fyi.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Create a database for your new PostgreSQL users to connect with &lt;code&gt;createdb dan&lt;/code&gt; where "dan" is whatever name you chose for the precious step.

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;sudo -u postgres createdb dan&lt;/code&gt; command can be run a root to do the same thing fyi.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now if you type &lt;code&gt;exit&lt;/code&gt; to leave the Postgres user role and type &lt;code&gt;sudo -i -u dan&lt;/code&gt; to switch into the user you created, you should be able to interact with the database created with the &lt;code&gt;psql&lt;/code&gt; command.

&lt;ul&gt;
&lt;li&gt;To leave the &lt;code&gt;psql&lt;/code&gt; cli interface type &lt;code&gt;\q&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a&gt;Step 3: The Database&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Here I am going to skip setting up the database as I will be using my API backend to configure a specific database for it. At the time of writing this my database is being hosted on Heroku so I can test that my frontend works properly and I will move it into the server later in this series.&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;




&lt;p&gt;Success! Now that the Linux, Apache, and PostgreSQL are configured it's time to move onto &lt;strong&gt;P&lt;/strong&gt;HP.&lt;/p&gt;

&lt;p&gt;[⭕]Linux&lt;br&gt;
[⭕]Apache&lt;br&gt;
[⭕]&lt;strong&gt;MySQL&lt;/strong&gt;&lt;br&gt;
[❌]PHP&lt;/p&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" alt="Happy Hacking ^_^"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;p&gt;&lt;a&gt;1.&lt;/a&gt; &lt;a href="https://en.wikipedia.org/wiki/LAMP_(software_bundle)"&gt;https://en.wikipedia.org/wiki/LAMP_(software_bundle)&lt;/a&gt;&lt;br&gt;
&lt;a&gt;2.&lt;/a&gt; &lt;a href="https://en.wikipedia.org/wiki/List_of_relational_database_management_systems"&gt;https://en.wikipedia.org/wiki/List_of_relational_database_management_systems&lt;/a&gt;&lt;br&gt;
&lt;a&gt;3.&lt;/a&gt; &lt;a href="https://www.ibm.com/cloud/blog/how-to-choose-a-database-on-ibm-cloud"&gt;https://www.ibm.com/cloud/blog/how-to-choose-a-database-on-ibm-cloud&lt;/a&gt;&lt;br&gt;
&lt;a&gt;4.&lt;/a&gt; &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-20-04"&gt;https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-20-04&lt;/a&gt;&lt;br&gt;
&lt;a&gt;5.&lt;/a&gt; &lt;a href="https://www.postgresql.org/docs/7.4/tutorial-arch.html"&gt;https://www.postgresql.org/docs/7.4/tutorial-arch.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;6.&lt;/a&gt; &lt;a href="https://www.postgresql.org/docs/7.4/tutorial-concepts.html"&gt;https://www.postgresql.org/docs/7.4/tutorial-concepts.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;7.&lt;/a&gt; &lt;a href="https://www.postgresql.org/download/linux/ubuntu/"&gt;https://www.postgresql.org/download/linux/ubuntu/&lt;/a&gt;&lt;br&gt;
&lt;a&gt;8.&lt;/a&gt; &lt;a href="https://gorails.com/deploy/ubuntu/20.04#database"&gt;https://gorails.com/deploy/ubuntu/20.04#database&lt;/a&gt;&lt;br&gt;
&lt;a&gt;9.&lt;/a&gt; &lt;a href="https://stackabuse.com/using-postgresql-with-nodejs-and-node-postgres/"&gt;https://stackabuse.com/using-postgresql-with-nodejs-and-node-postgres/&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  Please Note: that I am still learning and if something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
  
&lt;/h5&gt;

</description>
      <category>codenewbie</category>
      <category>sideprojects</category>
      <category>security</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>"A" is for Apache</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Fri, 25 Dec 2020 00:15:42 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/a-is-for-apache-3iem</link>
      <guid>https://dev.to/caffiendkitten/a-is-for-apache-3iem</guid>
      <description>&lt;p&gt;When I last left off I had just finished the main OS install. Now it's time for the "A" in LAMP, Apache. The "A" represents the "Apache HTTP Server" in the LAMP software stack. Apache will receive requests, process the requests, and then serves up associated web assets via the HTTP (HyperText Transfer Protocol) so that a website is accessible to anyone in the public domain via a simple URL.&lt;/p&gt;

&lt;p&gt;[⭕]Linux&lt;br&gt;
[❌]&lt;strong&gt;Apache&lt;/strong&gt;&lt;br&gt;
[❌]MySQL&lt;br&gt;
[❌]PHP&lt;/p&gt;

&lt;p&gt;In recent years the LAMP software stack has started to utilize Nginx, or other web servers, in place of Apache. "In June 2013, Netcraft estimated that Apache served 54.2% of all active websites and 53.3% of the top servers across all domains... In June 2014, Apache was estimated to serve 52.27% of all active websites, followed by Nginx with 14.36%." &lt;sup&gt;1&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:: From here on I will be showing commands with my applications name, &lt;code&gt;etcpasswdapp&lt;/code&gt;. Be sure to change them to &lt;em&gt;your applications name&lt;/em&gt;. By using my applications name this will allow for consistency between the steps and clearer representation of what commands you should be running.&lt;/strong&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;a&gt;Table Of Contents&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Step 1: Install Apache&lt;br&gt;
Step 2: Configuring Apache&lt;br&gt;
Step 2.1: Configuring Name-based Virtual Hosts &lt;br&gt;
Step 2.2: Configuring IP-based Virtual Hosts &lt;br&gt;
Step 2.3: Configuring Port Virtual Hosts &lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;a&gt;Step 1: Install Apache&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;To install Apache on a Ubuntu Server OS is super easy.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;sudo apt install apache2&lt;/code&gt; to install the Apache HTTP server and a very basic website in the &lt;code&gt;/var/www/html&lt;/code&gt; folder.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;ifconfig&lt;/code&gt; on the server computer to find the IP address of the server and then type it into my browser to confirm the Apache2 landing page is live. &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1JOfPC4Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ctehl987i9kfkffikl5m.png" alt="Alt Text"&gt;

&lt;ul&gt;
&lt;li&gt;Mine was something like &lt;code&gt;192.168.2.43&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GCkxKyNe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f1gyr5modcb3a962cpao.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GCkxKyNe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f1gyr5modcb3a962cpao.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Now that you have Apache installed it needs to be configured so you can host your own application/website.&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;a&gt;Step 2: Configuring Apache&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;To configure Apache you need to set up a "Virtual Host" and there are 3 types of Virtual Hosts available. (If you skipped over it you can refer to my previous definitions post on this.):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IP-based&lt;/strong&gt;: meaning that you have a different IP address for every web site, 172.20.30.40 or 172.20.30.50&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Name-based&lt;/strong&gt;: meaning that you have multiple names running on each IP address, blog1.example.com or blog2.example.com &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port&lt;/strong&gt;: meaning that you have multiple ports on one IP address for every web site, 172.20.30.40:8081 or 172.20.30.40:8080&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;No matter what type of VirtualHost you chose you will need to at least do these steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make a folder for your site to live in with &lt;code&gt;sudo mkdir /var/www/etcpasswdapp&lt;/code&gt;. 

&lt;ul&gt;
&lt;li&gt;Remember to name the directory the same name as the website that you want to create aby replacing "etcpasswdapp" with your website's name. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Navigate into the folder with &lt;code&gt;cd /var/www/etcpasswdapp&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add a basic index.html page for testing with &lt;code&gt;nano index.html&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mine just says "HiiIiIIiI" so I can see it's working.

&lt;code&gt;
&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;p&amp;gt;HiiIiIIiI&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now navigate into the "sites-available" folder with &lt;code&gt;cd /etc/apache2/sites-available/&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Here you will create a copy of the default configuration file "000-default.conf" with &lt;code&gt;sudo cp 000-default.conf etcpasswdapp.conf&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Don't forget to replace "etcpasswdapp" with your website's name. :)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now it's time to configure the Virtual Host for your set up. The following 3 sections will show a few different configuration options so take a minute to read over them and choose the best one for your situation.&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;a&gt;Step 2.1: Configuring Name-based Virtual Hosts &lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;There are two ways to configure the Name-Based Virtual Host depending on if you have a registered domain name, such as "&lt;a href="http://www.example.com"&gt;www.example.com&lt;/a&gt;", or not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With a registered domain&lt;/strong&gt;&lt;br&gt;
If you have a registered domain this tutorial "should" work for you. I say this because I am not able to test this part 100% as I don't have any registered domains.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate into the sites-available folder with &lt;code&gt;cd /etc/apache2/sites-available/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo nano etcpasswdapp.conf&lt;/code&gt; and follow the &lt;a href="https://ubuntu.com/tutorials/install-and-configure-apache#4-setting-up-the-virtualhost-configuration-file"&gt;Ubuntu tutorial&lt;/a&gt; for specifics that you will need to change add for your configuration.

&lt;ul&gt;
&lt;li&gt;If you are setting up a separate frontend and backend, like my set up, I recommend changing the "ServerAlias" to be like &lt;code&gt;*.etcpasswdapp.com&lt;/code&gt; so that it can account for an api address like &lt;code&gt;api.etcpasswdaoo.com&lt;/code&gt; that I will be using later for the backend configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo a2ensite etcpasswdapp.conf&lt;/code&gt; to add your site configuration to the enabled sites list.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo a2dissite 000-default.conf&lt;/code&gt; to disable the default configuration site.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo systemctl restart apache2&lt;/code&gt; to restart the apache service and you should now be able to connect to your registered domain in a browser on your client computer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Without a registered domain&lt;/strong&gt;&lt;br&gt;
If your client is a MAC, Linux, or Windows PC, all the above steps will be needed, in addition to the steps below, to allow you to connect to a non-registered domain name to your client computer through its "local hosts". For each client type below you will run the commands above here and then the commands below specific to your client computer type.&lt;/p&gt;

&lt;p&gt;▶️For a MAC or Linux client:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;nano /etc/hosts&lt;/code&gt; to edit the "hosts" file.&lt;/li&gt;
&lt;li&gt;Add a comment of &lt;code&gt;#VirtualHosts&lt;/code&gt; to the bottom of the file so you know which information you added.&lt;/li&gt;
&lt;li&gt;Below your comment add &lt;code&gt;192.168.2.43    etcpasswdapp.com&lt;/code&gt; for each of the web sites your are hosting. 

&lt;ul&gt;
&lt;li&gt;Be sure that you use the IP Address of YOUR server computer and the name of the domain that you want to access from your client computer.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Save and exit the "nano" editor and your site should be accessible in your client browser with the domain name your chose.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;▶️For a Windows client:&lt;br&gt;
This is the process that I used as an Admin on my client computer.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a "File Explorer" and navigate to the "hosts" file located at &lt;code&gt;C:\Windows\System32\drivers\etc\&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Open the "hosts" file in NotePad.&lt;/li&gt;
&lt;li&gt;Add a comment of &lt;code&gt;#Virtual Hosts&lt;/code&gt; to the bottom of the file.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;192.168.2.43    etcpasswdapp.com&lt;/code&gt; for each of the web sites your are hosting. 

&lt;ul&gt;
&lt;li&gt;Be sure that you use the IP Address of YOUR server computer and the domain that you want to access locally.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Before you can save the "hosts" file go back into the "File Explorer", right-click on the "hosts" file, and view its "Properties".

&lt;ul&gt;
&lt;li&gt;If you are not an Admin on your client computer you might need to contact them for this.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Go into the "Security" Tab.&lt;/li&gt;
&lt;li&gt;Select your User group and "Edit" their permissions for this file.&lt;/li&gt;
&lt;li&gt;Add the ability to "Modify" and "Write" the file and apply the changes.&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BvnxHjPi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u19p61xpukreqfxyo20x.png" alt="Alt Text"&gt;

&lt;ul&gt;
&lt;li&gt;It will give you a warning here but click "Yes".&lt;/li&gt;
&lt;li&gt;Also, be sure to change your permissions back as you shouldn't need to edit this again and don't want to let anything happen to this file by accident.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now you can save the "hosts" file that you edited in NotePad.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you still have issues accessing your site(s) you might run &lt;code&gt;sudo systemctl restart apache2&lt;/code&gt; on the server computer to restart the apache service again or you might need to restart your client computer. Whichever client computer you have this should change your new landing page to your sample "index.html" page. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Af_xONVq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fnsr7ivv1kv1t48deltr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Af_xONVq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fnsr7ivv1kv1t48deltr.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;a&gt;Step 2.2: Configuring IP-based Virtual Hosts &lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;This configuration will work to set up temporary "IP aliasing" for testing multiple IP addresses on a servers single NIC and will automatically be deleted once the system reboots.&lt;br&gt;
For this configuration to work permanently you need to either have multiple NICs (Network Interface Cards) or be able to configure virtual NICs on the server computer. Both of which are beyond the scope of this blog, but the basics of how to configure a IP-based VirtualHosts, assuming you have one of the mentioned set ups, you will be doing some of the steps as the Name-based VirtualHosts setup as well as adding an IP address into your configuration (See Step 4 below as it's second part is this configuration step) so the NICs knows where to direct traffic.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;ifconfig&lt;/code&gt; on the server to check what your ethernet connections name is and what IP address it is using.

&lt;ul&gt;
&lt;li&gt;On my server I currently have a local IP of "192.168.2.43/24" and I named it "EtherNetBond0" when I installed the Ubuntu Server OS.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo ip addr add 192.168.2.44/24 dev EtherNetBond0&lt;/code&gt; to create a new IP alias for this Network Interface. 

&lt;ul&gt;
&lt;li&gt;Note: that you can really choose any number for the 4th octet on the IP address as long as it is not being used by another device on you network.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Navigate into the "sites-available" folder with &lt;code&gt;cd /etc/apache2/sites-available/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo nano etcpasswdapp.conf&lt;/code&gt; and follow the &lt;a href="https://ubuntu.com/tutorials/install-and-configure-apache#4-setting-up-the-virtualhost-configuration-file"&gt;Ubuntu tutorial&lt;/a&gt; for specifics that you will need to change add for your configuration.&lt;/li&gt;
&lt;li&gt;While still editing the conf file for the application that you want to access through a different ip address be sure to change its &lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&lt;/code&gt; to &lt;code&gt;&amp;lt;VirtualHost 192.168.2.60:80&amp;gt;&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;*&lt;/code&gt; represents what IP addresses will be used to connect the site on the server. Changing &lt;code&gt;*:80&lt;/code&gt; to &lt;code&gt;192.168.2.60:80&lt;/code&gt; will enable the separation of IP address connections of incoming traffic on port 80 and allow for more VirtualHost connections through different IP addresses on the server.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo a2ensite etcpasswdapp.conf&lt;/code&gt; to add your site configuration to the enabled sites list.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo a2dissite 000-default.conf&lt;/code&gt; to disable the default configuration site.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo systemctl restart apache2&lt;/code&gt; to restart the apache service. &lt;/li&gt;
&lt;li&gt;You should now be able to connect to your website in a browser on your client computer with the IP address you chose.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;a&gt;Step 2.3: Configuring Port Virtual Hosts &lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;The configuration of Port Based VirtualHosts is similar to configuring Name-based VirtualHosts but with a port specification and configuration of the UFW (Uncomplicated Firewall).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate into the "sites-available" folder with &lt;code&gt;cd /etc/apache2/sites-available/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo nano etcpasswdapp.conf&lt;/code&gt; and follow the &lt;a href="https://ubuntu.com/tutorials/install-and-configure-apache#4-setting-up-the-virtualhost-configuration-file"&gt;Ubuntu tutorial&lt;/a&gt; for specifics that you will need to change add for your configuration.&lt;/li&gt;
&lt;li&gt;Now change its &lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&lt;/code&gt; to &lt;code&gt;&amp;lt;VirtualHost *:8080&amp;gt;&lt;/code&gt; or whatever port your choose. 

&lt;ul&gt;
&lt;li&gt;Becareful not to use a port that is in use or could be in use by choosing a high number or look up what numbers are commonly in use to avoid them.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Save the file and exit the editor.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo a2ensite etcpasswdapp.conf&lt;/code&gt; to add your site configuration to the enabled sites list.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo a2dissite 000-default.conf&lt;/code&gt; to disable the default configuration site.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo systemctl restart apache2&lt;/code&gt; to restart the apache service and set the changes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now that the basics are set up you now need to configure the UFW (Uncomplicated Firewall), which should be pre-installed on the Ubuntu server, to allow web traffic to that specific port.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Run &lt;code&gt;sudo ufw app list&lt;/code&gt; to look at your UFW application list. It should show 4 available applications: Apache, Apache Full, Apache Secure, and OpenSSH.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Available applications:
    - Apache
    - Apache Full
    - Apache Secure
    - OpenSSH
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;sudo ufw status&lt;/code&gt; to view your current Apache Full profile status and what pots are open. It should show that it enables traffic to ports 80 and 443.&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jMcQeCyu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pf3ktdna7xlqc18o740l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jMcQeCyu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pf3ktdna7xlqc18o740l.png" alt="ufw status"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;sudo ufw allow in "Apache Full"&lt;/code&gt; to allow for incoming traffic for the "Apache Full" profile. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Now run &lt;code&gt;sudo ufw allow 8080/tcp&lt;/code&gt; (or whatever port you chose to host your application on)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you run the &lt;code&gt;sudo ufw status&lt;/code&gt; again it should now show the port your added.&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3uQIdN7n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0ieglh4znnzydrv3r9dc.png" alt="new ufw status"&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;sudo systemctl restart apache2&lt;/code&gt; to restart the apache service and you should be able to connect to your registered domain in a browser now.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;Couple notes here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You might need to add your server IP address to the "hosts" file for this configuration to work, like I did with the Name-Based configuration.&lt;/li&gt;
&lt;li&gt;You cannot add an IP address with a specific port to the "hosts" file and it's not designed for this. If you desire to access your website through a specific port you will need to add the IP address to your "hosts" file and bookmark the specific port in a browser.&lt;/li&gt;
&lt;li&gt;If you want to see the configuration this sets navigate to the "user.rules" and "user6.rules" files with the &lt;code&gt;cd /etc/ufw&lt;/code&gt; and look at the user files with the &lt;code&gt;less user.rules&lt;/code&gt; and &lt;code&gt;less user6.rules&lt;/code&gt; commands.&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hWGhXJl9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3z8poqp9a75ogcvuf350.jpg" alt="Alt Text"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OQ47x4yZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mazpbqq2o0jjizzichd4.jpg" alt="Alt Text"&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;less&lt;/code&gt; and &lt;code&gt;cat&lt;/code&gt; commands both read the file but &lt;code&gt;less&lt;/code&gt; will allow you to scroll through the file if it is too big to fit on the screen.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the Table Of Contents}&lt;/p&gt;



&lt;br&gt;
Success! Hopefully that worked for you because it's now that Linux and the Apache HTTP server are installed and configured it's time to move onto the database, &lt;del&gt;MySQL&lt;/del&gt; Postgress.

&lt;p&gt;[⭕]Linux&lt;br&gt;
[⭕]&lt;strong&gt;Apache&lt;/strong&gt;&lt;br&gt;
[❌]MySQL&lt;br&gt;
[❌]PHP&lt;/p&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" alt="Happy Hacking ^_^"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;p&gt;&lt;a&gt;1.&lt;/a&gt; &lt;a href="https://news.netcraft.com/archives/2014/06/06/june-2014-web-server-survey.html"&gt;https://news.netcraft.com/archives/2014/06/06/june-2014-web-server-survey.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;2.&lt;/a&gt; &lt;a href="https://news.netcraft.com/archives/2013/06/06/june-2013-web-server-survey-3.html"&gt;https://news.netcraft.com/archives/2013/06/06/june-2013-web-server-survey-3.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;3.&lt;/a&gt; &lt;a href="https://en.wikipedia.org/wiki/Virtual_hosting"&gt;https://en.wikipedia.org/wiki/Virtual_hosting&lt;/a&gt;&lt;br&gt;
&lt;a&gt;4.&lt;/a&gt; &lt;a href="http://httpd.apache.org/docs/current/vhosts/"&gt;http://httpd.apache.org/docs/current/vhosts/&lt;/a&gt;&lt;br&gt;
&lt;a&gt;5.&lt;/a&gt; &lt;a href="https://httpd.apache.org/docs/2.4/vhosts/examples.html"&gt;https://httpd.apache.org/docs/2.4/vhosts/examples.html&lt;/a&gt;&lt;br&gt;
&lt;a&gt;6.&lt;/a&gt; &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04"&gt;https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04&lt;/a&gt;&lt;br&gt;
&lt;a&gt;7.&lt;/a&gt; &lt;a href="https://wiki.ubuntu.com/UncomplicatedFirewall?action=show&amp;amp;redirect=UbuntuFirewall"&gt;https://wiki.ubuntu.com/UncomplicatedFirewall?action=show&amp;amp;redirect=UbuntuFirewall&lt;/a&gt;&lt;br&gt;
&lt;a&gt;8.&lt;/a&gt; &lt;a href="https://wiki.ubuntu.com/UbuntuFirewallSpec"&gt;https://wiki.ubuntu.com/UbuntuFirewallSpec&lt;/a&gt;&lt;br&gt;
&lt;a&gt;9.&lt;/a&gt; &lt;a href="https://stackoverflow.com/questions/8652948/using-port-number-in-windows-host-file"&gt;https://stackoverflow.com/questions/8652948/using-port-number-in-windows-host-file&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  Please Note: that I am still learning and if something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
  
&lt;/h5&gt;

</description>
      <category>codenewbie</category>
      <category>security</category>
      <category>sideprojects</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>"L" is for Linux</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Fri, 25 Dec 2020 00:13:22 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/l-is-for-linux-512n</link>
      <guid>https://dev.to/caffiendkitten/l-is-for-linux-512n</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;Now that we have some info out of the way in part 1 of this series, it's time to build a server. First up is the OS. &lt;/p&gt;

&lt;p&gt;[❌]&lt;strong&gt;Linux&lt;/strong&gt;&lt;br&gt;
[❌]Apache&lt;br&gt;
[❌]MySQL&lt;br&gt;
[❌]PHP&lt;/p&gt;

&lt;p&gt;As stated in the intro post for this series, "L" represents Linux in LAMP software stack. LAMP (&lt;strong&gt;L&lt;/strong&gt;inux, &lt;strong&gt;A&lt;/strong&gt;pache, &lt;strong&gt;M&lt;/strong&gt;ySQL, &lt;strong&gt;P&lt;/strong&gt;HP) is an open source software stack where each component contributes essential capabilities to an application. Though almost any OS, HTTP server, Database Manager, and data processing software could be used that suites your need the LAMP stack "has a classic layered architecture, with Linux at the lowest level followed by Apache, MySQL, and PHP. Although PHP is nominally at the top or presentation layer, the PHP component sits inside Apache." &lt;sup&gt;5&lt;/sup&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a&gt;Table Of Contents&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Step 1: Picking out the Server's OS&lt;br&gt;
Step 2: OS Install&lt;br&gt;
Step 2.1: Setting up network access&lt;br&gt;
Step 3: The Install&lt;br&gt;
Step 4: Ping Test&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a&gt;Step 1: Picking Out the Server's OS&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Though there are a lot of options for the servers Operating System, I don't need any type of crazy set up and I don't want to spend any money. With this in mind that means that any Windows Server is out as I don't want a Free Trial product and it's about $100+; so I will stick with a Linux/Unix based OS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.smarthomebeginner.com%2Fimages%2F2015%2F02%2Fbest-home-server-software-ft.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.smarthomebeginner.com%2Fimages%2F2015%2F02%2Fbest-home-server-software-ft.jpg" alt="Server OS Options"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As far as free server OS options it depends a lot on your intended use.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you want a media storage server specifically you could chose &lt;a href="https://www.plex.tv/" rel="noopener noreferrer"&gt;Plex Media Server&lt;/a&gt;, &lt;a href="https://www.freenas.org/" rel="noopener noreferrer"&gt;FreeNAS&lt;/a&gt;, or &lt;a href="https://kodi.tv/" rel="noopener noreferrer"&gt;Kodi Open Source Home Theatre Software&lt;/a&gt; to name a few.&lt;/li&gt;
&lt;li&gt;If you want some flexibility you might try some server management software like &lt;a href="https://www.amahi.org/" rel="noopener noreferrer"&gt;Amahi Home Server&lt;/a&gt; that is installed on top of Fedora or CentOS servers and comes pre-installed with a lot of services already.&lt;/li&gt;
&lt;li&gt;If you want to configure it yourself, like me, you might choose &lt;a href="https://ubuntu.com/download/server" rel="noopener noreferrer"&gt;Ubuntu Server Edition&lt;/a&gt;, &lt;a href="http://www.clearfoundation.com/Software/overview.html" rel="noopener noreferrer"&gt;ClearOS&lt;/a&gt;, or &lt;a href="https://getfedora.org/" rel="noopener noreferrer"&gt;Fedora Server&lt;/a&gt; to name a few.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After some research on the abilities of the server software, I decided on &lt;a href="https://ubuntu.com/download/server" rel="noopener noreferrer"&gt;Ubuntu Server Edition&lt;/a&gt; because I need something that is widely used in production environments. Now it's time to work on installing it onto an old computer I have hanging out in my office. &lt;/p&gt;

&lt;p&gt;{Back to the ToC}&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a&gt;Step 2: Pre-OS Install&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Server install will very a lot depending on the one you chose, but for my &lt;a href="https://ubuntu.com/download/server" rel="noopener noreferrer"&gt;Ubuntu Server Edition&lt;/a&gt; it was super straight forward. The only hiccup was that it did not want to install with WIFI as its' main Internet connection point. &lt;/p&gt;

&lt;p&gt;Why you ask? This is because the vast majority of NICs (Network Interface Cards) that are in computers are almost all the same, or there is very little variation, so it's easier to have the drivers already as part of the server OS at install. In contrast, basically every WIFI adapter out there is different and it would be next to pointless for an OS to come with drivers for some 200 WIFI adapters when they could have maybe 10 NIC drivers.&lt;/p&gt;

&lt;p&gt;There are ways around it if you know the computers NIC interface, buuuuut it's easier just to have a Ethernet cord there for it.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a&gt;Step 2.1: Setting up Network access&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;For my server OS install there might was an extra step here because servers don't like to use WIFI as their main connection and my office did not have an Ethernet connection in it.&lt;/p&gt;

&lt;p&gt;For my setup, this means that I need a switch to split the Ethernet connection coming into my office. This is easy enough as its a plug-and-play style device and just needs to be plugged in. I take my incoming Ethernet cord and plug it into slot #1 and then add another Ethernet cord into slot #2 for my server computer and one more into slot #3 (respectively) for my client computer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftarget.scene7.com%2Fis%2Fimage%2FTarget%2FGUEST_88e15c08-9c51-45ca-a293-af115d3eca96%3Fwid%3D325%26hei%3D325%26qlt%3D80%26fmt%3Dwebp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftarget.scene7.com%2Fis%2Fimage%2FTarget%2FGUEST_88e15c08-9c51-45ca-a293-af115d3eca96%3Fwid%3D325%26hei%3D325%26qlt%3D80%26fmt%3Dwebp" alt="Server sample image form Targer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;{Back to the ToC}&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a&gt;Step 3: The Install&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Thanks to the &lt;a href="https://ubuntu.com/tutorials/install-ubuntu-server#1-overview" rel="noopener noreferrer"&gt;"Install Ubuntu Server" tutorial&lt;/a&gt; all the steps are broken down nicely so go there if you need help as I wont go into much detail here. Just follow the tutorial and it explains really well what you might need to do for your setup. For my, I did notice that some steps didn't quite look the same but it worked out just fine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To follow the tutorial steps as best as able for my system and a basic configuration I did:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Downloading the ISO file in the &lt;a href="https://ubuntu.com/download/server" rel="noopener noreferrer"&gt;Manual install&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Burning it to a USB or CD (I used &lt;a href="https://www.balena.io/etcher/" rel="noopener noreferrer"&gt;BalenaEtcher&lt;/a&gt; to burn the ISO to a USB)&lt;/li&gt;
&lt;li&gt;Install it on the desired computer following the tutorial steps. &lt;/li&gt;
&lt;li&gt;&lt;a href="https://paginas.fe.up.pt/%7Eacbrito/laudon/ch8/chpt8-3main.htm" rel="noopener noreferrer"&gt;https://paginas.fe.up.pt/~acbrito/laudon/ch8/chpt8-3main.htm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.computerhope.com/jargon/s/server.htm" rel="noopener noreferrer"&gt;https://www.computerhope.com/jargon/s/server.htm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Server_(computing)" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/Server_(computing)&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnir41hh64vnj719092qy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnir41hh64vnj719092qy.png" alt="install complete"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note: This series will used a "headless" server; meaning that it will not have any type of Graphical User Interface and that once it is installed, it will not need a monitor. Because of this all interaction with the server will be done through the server's terminal directly or via SSH from my main "client" computer (Windows).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;{Back to the ToC}&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a&gt;Step 4: Ping Test&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Once the server is installed it's good to make sure that it's all working and you can interact with it from your client as download the Ubuntu net-tools.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You can ensure it has Internet connectivity in general by running &lt;code&gt;ping 8.8.8.8&lt;/code&gt; (Google's DNS) from the servers terminal or it might be evident during setup if it is connected and working as the Ubuntu Server OS I installed said it needed some updates from version 20.04 to 20.09 during the install. &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F82uihwpdruwtn2303rfp.png" alt="sample updates confirmation"&gt;
&lt;/li&gt;
&lt;li&gt;Next I recommend installing the Ubuntu net-tools with &lt;code&gt;apt install net-tools&lt;/code&gt; on the server computer. This tool contains the &lt;code&gt;ifconfig&lt;/code&gt; command that allows you to see your servers IP address.&lt;/li&gt;
&lt;li&gt;Run the &lt;code&gt;ifconfig&lt;/code&gt; command once downloaded to view your servers IP address.&lt;/li&gt;
&lt;li&gt;Now that you know the server's IP address run the "ping" command from you client computer's terminal with the IP address of your server computer to confirm that your client can see your server. (Something like: &lt;code&gt;ping 192.168.1.14&lt;/code&gt; but will can very depending on your home network.)&lt;/li&gt;
&lt;li&gt;Once the client computer can see the server computer, it's good to ping the client computer from the server. Being that my client is a Windows PC I ran &lt;code&gt;ipconfig&lt;/code&gt; in my Windows terminal to find its' IP address and then ran &lt;code&gt;ping 192.168.1.15&lt;/code&gt; from my server computer to my client.

&lt;ul&gt;
&lt;li&gt;Note: you might need to restart your server and client for this to work. I tried refreshing the caches manually but restarting fixed an issue that wouldn't let my client PC ping my server. Restarting will force refresh the device's cache. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;{Back to the ToC}&lt;/p&gt;



&lt;br&gt;
Success! The &lt;strong&gt;L&lt;/strong&gt;inux OS install is done and it's on to &lt;strong&gt;A&lt;/strong&gt;pache.

&lt;p&gt;[⭕]&lt;strong&gt;Linux&lt;/strong&gt;&lt;br&gt;
[❌]Apache&lt;br&gt;
[❌]MySQL&lt;br&gt;
[❌]PHP&lt;/p&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgsiwm8b52w3ci2sn5b3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgsiwm8b52w3ci2sn5b3.gif" alt="Happy Hacking ^_^"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;p&gt;&lt;a&gt;1.&lt;/a&gt; &lt;a href="https://www.smarthomebeginner.com/best-home-server-software-os/" rel="noopener noreferrer"&gt;https://www.smarthomebeginner.com/best-home-server-software-os/&lt;/a&gt;&lt;br&gt;
&lt;a&gt;2.&lt;/a&gt; &lt;a href="https://www.technorms.com/77526/home-server" rel="noopener noreferrer"&gt;https://www.technorms.com/77526/home-server&lt;/a&gt;&lt;br&gt;
&lt;a&gt;3.&lt;/a&gt; &lt;a href="https://ubuntu.com/tutorials/install-ubuntu-server#1-overview" rel="noopener noreferrer"&gt;https://ubuntu.com/tutorials/install-ubuntu-server#1-overview&lt;/a&gt;&lt;br&gt;
&lt;a&gt;4.&lt;/a&gt; &lt;a href="http://net-tools.sourceforge.net/" rel="noopener noreferrer"&gt;http://net-tools.sourceforge.net/&lt;/a&gt;&lt;br&gt;
&lt;a&gt;5.&lt;/a&gt; &lt;a href="https://www.ibm.com/cloud/learn/lamp-stack-explained" rel="noopener noreferrer"&gt;https://www.ibm.com/cloud/learn/lamp-stack-explained&lt;/a&gt;&lt;/p&gt;
Please Note: If anything that I have stated is incorrect please let me know what and why. I would love to learn more about what I may not fully understand yet.



</description>
      <category>todayilearned</category>
      <category>codenewbie</category>
      <category>security</category>
      <category>sideprojects</category>
    </item>
    <item>
      <title>SOP vs CORS?</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Sat, 12 Dec 2020 02:22:16 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/sop-vs-cors-49l6</link>
      <guid>https://dev.to/caffiendkitten/sop-vs-cors-49l6</guid>
      <description>&lt;p&gt;According to the Merriam-Webster dictionary, an "origin" is a &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;rise, beginning, or derivation from a source&lt;/code&gt;. (1) &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The concept of an "origin" on the web was first introduced by Netscape Navigator in version 2.02 in 1995; with the original intent to "automatically prevent scripts on one server from accessing properties of documents on a different server." (2) They didn't use the words "origin" but the heart of it was there. Since this time the Internet has evolved a lot and now there are 2 specific separation of origin policies, Same-Origin and Cross-Origin, that help build the trust relationship between a user and a resource.&lt;/p&gt;

&lt;h1&gt;
  
  
  SOP
&lt;/h1&gt;

&lt;p&gt;The SOP (Same-Origin Policy) is a web browser security mechanism that prevents of JavaScript, and other scripting languages, from getting access to the DOM properties and methods. It is arguable the most important security concept within modern browsers, according to Google. (3)&lt;/p&gt;

&lt;p&gt;According to &lt;a href="https://tools.ietf.org/html/rfc6454" rel="noopener noreferrer"&gt;RFC6454 section 3.5&lt;/a&gt; "the same-origin policy uses URIs to designate trust relationships." (4) It does so by grouping URIs, by origin, as a representation of protection domains. These protection domains control which resources in a origin are granted authority to access objects and network resources within its own origin. &lt;/p&gt;

&lt;p&gt;This policy is noticeably important for security because it is common browser behavior to include any cookies, including authentication session cookies, relevant to the other domain as part of the request when sending an HTTP request from one origin to another.&lt;/p&gt;

&lt;p&gt;The RFC standard URL value that SOP follows is use an algorithm to match the protocol, hostname, and port of a request; though not all browsers care about the port.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fcj18qqaoanc7yzwv5m96.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fcj18qqaoanc7yzwv5m96.png" alt="SOP schema"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The RFC standard says that&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Two origins are "the same" if, and only if, they are identical.
In particular:
 * If the two origins are scheme/host/port triples, the two 
origins are the same if, and only if, they have identical 
schemes, hosts, and ports.
 * An origin that is a globally unique identifier cannot 
be the same as an origin that is a scheme/host/port triple.

Two URIs are same-origin if their origins are the same.

   NOTE: A URI is not necessarily same-origin with itself.
 For example, a data URI [RFC2397] is not same-origin with
 itself because data URIs do not use a server-based naming 
authority and therefore have globally unique identifiers 
as origins.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, when the URI from above is compared with the URIs below you can see why they would not be considered "same-origin."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fonhxevwvbtad2ruvaa11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fonhxevwvbtad2ruvaa11.png" alt="Not Same-origin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  CORS
&lt;/h1&gt;

&lt;p&gt;Cross-Origin Resource Sharing (CORS) is a mechanism that allows access to resources across origins. Implemented as an extension of the Same-Origin Policy, CORS enables servers to specify any other origins allowed to share resources with though a suite of HTTP headers that define any trusted origins and associated properties that are combined during the exchange between a Browsers and a resource across web origins. For example, if an API is used on &lt;a href="http://example.org" rel="noopener noreferrer"&gt;http://example.org&lt;/a&gt;, &lt;a href="http://hello-world.example" rel="noopener noreferrer"&gt;http://hello-world.example&lt;/a&gt; can &lt;em&gt;opt in&lt;/em&gt; using the mechanism of the &lt;code&gt;Access-Control-Allow-Origin: http://example.org&lt;/code&gt; as a response header, which would allow the resource to be fetched cross-origin from &lt;a href="http://example.org" rel="noopener noreferrer"&gt;http://example.org&lt;/a&gt;. (8)&lt;/p&gt;

&lt;p&gt;CORS has an "opt in" mechanism where user agents (Browsers) will, typically, isolate content retrieved from different origins, by default, to prevent malicious web site operators from interfering with the operations of benign web sites and to prevent leaking of data. (9)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Be Warned:&lt;/strong&gt; This does NOT mean that CORS is security. &lt;br&gt;
CORS != Security.&lt;br&gt;
CORS is a way of easing up on the strict same-origin policy of resource sharing and NOT a mechanism to enforce general security or prevent against a variety of risky scenarios.&lt;/p&gt;

&lt;h1&gt;
  
  
  SOP and CORS Limitations and Importance
&lt;/h1&gt;

&lt;p&gt;Implementing SOP and CORS doesn't mean your website is secure, but is an important security concept within modern browsers. (3) &lt;/p&gt;

&lt;p&gt;SOP doesn't completely eliminate interaction between different origins and CORS is needed to allow a Browser and server to each evaluate whether any specific interaction may pose a threat and if not, allow it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmdn.mozillademos.org%2Ffiles%2F14295%2FCORS_principle.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmdn.mozillademos.org%2Ffiles%2F14295%2FCORS_principle.png" alt="MDN CORS Principle"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Furthermore, though reading between origins is usually blocked, this doesn't apply to HTML tags. This means a web page may freely embed cross-origin images, stylesheets, scripts, iframes, and/or videos and these resources still be accessed across origins through the associated HTML tag.&lt;/p&gt;

&lt;p&gt;Lastly, though reading between origins is usually blocked this usually means you can still send a cross-origin requests but reading the response is prevented.&lt;/p&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgsiwm8b52w3ci2sn5b3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgsiwm8b52w3ci2sn5b3.gif" alt="Happy Hacking ^_^"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.merriam-webster.com/dictionary/origin" rel="noopener noreferrer"&gt;https://www.merriam-webster.com/dictionary/origin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.archive.org/web/20020808153106/http://wp.netscape.com:80/eng/mozilla/3.0/handbook/javascript/advtopic.htm#1009533" rel="noopener noreferrer"&gt;https://web.archive.org/web/20020808153106/http://wp.netscape.com:80/eng/mozilla/3.0/handbook/javascript/advtopic.htm#1009533&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.google.com/archive/p/browsersec/wikis/Part2.wiki#Same-origin_policy" rel="noopener noreferrer"&gt;https://code.google.com/archive/p/browsersec/wikis/Part2.wiki#Same-origin_policy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tools.ietf.org/html/rfc6454" rel="noopener noreferrer"&gt;https://tools.ietf.org/html/rfc6454&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://portswigger.net/web-security/cors" rel="noopener noreferrer"&gt;https://portswigger.net/web-security/cors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://portswigger.net/web-security/cors/same-origin-policy" rel="noopener noreferrer"&gt;https://portswigger.net/web-security/cors/same-origin-policy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fetch.spec.whatwg.org/" rel="noopener noreferrer"&gt;https://fetch.spec.whatwg.org/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/TR/2020/SPSD-cors-20200602/" rel="noopener noreferrer"&gt;https://www.w3.org/TR/2020/SPSD-cors-20200602/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tools.ietf.org/html/rfc6454" rel="noopener noreferrer"&gt;https://tools.ietf.org/html/rfc6454&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h5&gt;
  
  Please Note: that I am still learning and if something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
  
&lt;/h5&gt;

</description>
      <category>todayilearned</category>
      <category>codenewbie</category>
      <category>security</category>
      <category>browsers</category>
    </item>
    <item>
      <title>Browser Communications</title>
      <dc:creator>DaNeil C</dc:creator>
      <pubDate>Fri, 11 Dec 2020 21:16:54 +0000</pubDate>
      <link>https://dev.to/caffiendkitten/browser-communications-11p6</link>
      <guid>https://dev.to/caffiendkitten/browser-communications-11p6</guid>
      <description>&lt;p&gt;Hope you read about &lt;a href="https://dev.to/caffiendkitten/what-is-your-browser-doing-3pg"&gt;What browsers are doing&lt;/a&gt; when you make a request for a resource and &lt;a href="https://dev.to/caffiendkitten/how-do-browser-make-websites-3709"&gt;How do browsers make websites&lt;/a&gt; because today we are going to continue this series with How Browsers communicate.&lt;/p&gt;

&lt;p&gt;We already established that there are no set rules when dealing with the web but then how are browsers are to communicate?&lt;br&gt;
&lt;a href="https://i.giphy.com/media/9uIvZp1vfcWnNt4u5A/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/9uIvZp1vfcWnNt4u5A/giphy.gif" alt="hmmmmm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Protocols
&lt;/h1&gt;

&lt;p&gt;Browsers communicate using "protocols"... Or really &lt;em&gt;any&lt;/em&gt; network based communications use protocols.&lt;br&gt;
Protocols are a, loosely followed, set of rules that say how routing and addressing packets of data is done to allow two or more entities to share information. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.myf5.net%2Fupload%2Fnetworkprotocol.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.myf5.net%2Fupload%2Fnetworkprotocol.jpg"&gt;&lt;/a&gt;&lt;br&gt;
As shown above, there are a &lt;em&gt;lot&lt;/em&gt; of different types of protocols that are used at different stages of network communication. But, only a "few" of these make up the "Internet Protocol Stack" or the "Internet Protocol Suite". &lt;/p&gt;

&lt;h1&gt;
  
  
  The Internet Protocol Suite
&lt;/h1&gt;

&lt;p&gt;The IPS is a conceptual model and suite of communications protocols (or "stack of protocols") used in the Internet to provide end-to-end data communication and specifying how data should be packetized, addressed, transmitted, routed, and received.&lt;/p&gt;

&lt;p&gt;The foundational protocols in the suite are the Transmission Control Protocol (TCP) and the Internet Protocol (IP); and thus it is commonly referred to as simply the TCP/IP Suite.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faoos8n2651h5gtmdhmih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faoos8n2651h5gtmdhmih.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
Internet Protocol Stack:&lt;br&gt; Note: Some of the layers of the Internet Protocol Suite are not exactly where this diagram shows them or are used at multiple stages in the stack depending on their use.



&lt;h2&gt;
  
  
  Internet Protocol
&lt;/h2&gt;

&lt;p&gt;The Internet Protocol (IP) is generally considered the base protocol that all other Internet based protocols sit on top of, is the first to be interacted with when data is received, and introduces the "virtual network abstraction that is the basic principle of the Internet model." (1)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnetworkencyclopedia.com%2Fwp-content%2Fuploads%2F2019%2F09%2Finternet-protocol-in-tcp-ip.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnetworkencyclopedia.com%2Fwp-content%2Fuploads%2F2019%2F09%2Finternet-protocol-in-tcp-ip.jpg" alt="Internet Protocol Stack"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the very basics level, the Internet Protocol uses a "Internet Datagram" to exchange data though specified encapsulation and lacks any functionality for error handling when datagrams are either duplicated, lost, or arrive to the remote host in another order than they were sent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.w3.org%2FPeople%2FFrystyk%2Fthesis%2FIPFrame.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.w3.org%2FPeople%2FFrystyk%2Fthesis%2FIPFrame.gif" alt="IP Datagram caption="&gt;&lt;/a&gt;IP Datagram&lt;/p&gt;

&lt;h2&gt;
  
  
  TCP/UDP
&lt;/h2&gt;

&lt;p&gt;The TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) protocols that sit on top of the Internet Protocols in the "Transport Layer" of the TCP/IP Model. Note:: There are a few other protocols at this level, but TCP and UDP are the most commonly used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UDP&lt;/strong&gt;&lt;br&gt;
The UDP is an end-to-end communications protocol that contains just enough information to transfer a "user datagram" from one process on the transmitting host to another process on the receiving host. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.w3.org%2FPeople%2FFrystyk%2Fthesis%2FUDPFrame.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.w3.org%2FPeople%2FFrystyk%2Fthesis%2FUDPFrame.gif" alt="User Datagram"&gt;&lt;/a&gt;User Datagram&lt;/p&gt;

&lt;p&gt;Much like IP though, UDP is an connectionless, unreliable service that transfers data before any agreement is provided by the receiving party. Because of this UDP is primarily used for low-latency(low-delay) and loss-tolerating connections such as voice over Internet Protocol (VoIP), domain name system (DNS) lookup, and video or audio playback.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TCP&lt;/strong&gt;&lt;br&gt;
The TCP (Transmission Control Protocol) is a reliable, stream oriented service for connection of application layer software with a service. Because TCP was one of the first network implementations that complemented the IP, it is commonly referred to as TCP/IP.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.w3.org%2FPeople%2FFrystyk%2Fthesis%2FTCPSegment.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.w3.org%2FPeople%2FFrystyk%2Fthesis%2FTCPSegment.gif" alt="TCP Segment"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TCP requires a connection between client and server to be established before a segment of the actual application data can be sent (also known as the three-way handshake). It uses this connection to establish a virtual circuit between the two transmitting hosts so that both hosts can simultaneously put data out on the Internet without specifying the destination host once the connection is established. &lt;/p&gt;

&lt;h2&gt;
  
  
  Application Layer
&lt;/h2&gt;

&lt;p&gt;Above the UDP and TCP Transport Layer, respectively, is the Application layer where more protocols provide applications with a standardized way to exchange data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UDP Side&lt;/strong&gt;&lt;br&gt;
The main protocols on the UDP side include DNS, Network Time Protocol (NTP), BOOTP, and DHCP, but there are more.&lt;/p&gt;

&lt;p&gt;These protocols are generally used here because of the lack of need for real-time error handling and the need for a large number of clients to be connected at once.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TCP Side&lt;/strong&gt;&lt;br&gt;
The main protocols usually used on the TCP side include HTTPS, "HTTP, FTP, Post Office Protocol 3 (POP3), Simple Mail Transfer Protocol (SMTP), and Simple Network Management Protocol (SNMP)." (2)&lt;/p&gt;

&lt;p&gt;These protocols are usually used here because of the need for compatible with a variety of operating systems, scalability and reliability as the internet grows, and the ability to recover automatically from the failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Access ports
&lt;/h2&gt;

&lt;p&gt;As stated above, each side (UDP vs TCP) has their top protocols that are generally used on them, but how do you access them and what do they do?&lt;/p&gt;

&lt;p&gt;The generally agreed upon way to access each protocol is through the logical construct that identifies a specific process, or a type of network service, called a port. &lt;/p&gt;

&lt;p&gt;I don't want to dive deep into all of the protocols and ports at this level (because there are 65,535 ports), but a few of the main ports and their associated protocol as well as a few explanations of a few popular ports.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;20/21: File Transfer Protocol (FTP)&lt;/li&gt;
&lt;li&gt;22: Secure Shell (SSH) Secure Login&lt;/li&gt;
&lt;li&gt;23: Telnet remote login service, unencrypted text messages&lt;/li&gt;
&lt;li&gt;25: Simple Mail Transfer Protocol (SMTP) E-mail routing&lt;/li&gt;
&lt;li&gt;53: Domain Name System (DNS) service&lt;/li&gt;
&lt;li&gt;67, 68: Dynamic Host Configuration Protocol (DHCP)&lt;/li&gt;
&lt;li&gt;80: Hypertext Transfer Protocol (HTTP)&lt;/li&gt;
&lt;li&gt;110: Post Office Protocol (POP3)&lt;/li&gt;
&lt;li&gt;119: Network News Transfer Protocol (NNTP)&lt;/li&gt;
&lt;li&gt;123: Network Time Protocol (NTP)&lt;/li&gt;
&lt;li&gt;143: Internet Message Access Protocol (IMAP) Management of digital mail&lt;/li&gt;
&lt;li&gt;161: Simple Network Management Protocol (SNMP)&lt;/li&gt;
&lt;li&gt;194: Internet Relay Chat (IRC)&lt;/li&gt;
&lt;li&gt;443: HTTP Secure (HTTPS) HTTP over TLS/SSL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Port 80: HTTP&lt;/strong&gt;&lt;br&gt;
By far the most common port, HTTP defines the rules for transferring files, images, and other media to and from web browsers with web servers over the TCP/IP connection.&lt;br&gt;
HTTP is a stateless protocol that requires all requests to originate from the client-side browser and are then sent to a specific server to process the request and send back a response. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpr5ud043p2cie5belwbm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpr5ud043p2cie5belwbm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port 443: HTTPS&lt;/strong&gt;&lt;br&gt;
This port is steadily becoming used more than port 80 because of its added security through encryption to protect all data exchanges used on it. As shown below, a normal HTTP request/response will be in plain text for anyone to see, but HTTPS encrypts the correspondence so that they cannot be ready by any unintended viewers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsectigostore.com%2Fblog%2Fwp-content%2Fuploads%2F2020%2F06%2Fport-443-how-https-works-1024x429.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsectigostore.com%2Fblog%2Fwp-content%2Fuploads%2F2020%2F06%2Fport-443-how-https-works-1024x429.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;HTTPS is HTTP over an SSL/TLS connection that makes use of public key encryption (where there are two keys — public and private) to distribute a shared symmetric key, which is then used for transmission. (9)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port 53: DNS&lt;/strong&gt;&lt;br&gt;
A DNS (Domain Name System) is kind of like a phonebook that lives at your Internet Service Provider (ISP); or on your local system in a few places.&lt;br&gt;
In short, when you make a request for a website (&lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt;) your system will use UDP to attempt to locate its IP address by recursively making DNS requests to attempt to locate and translate your requested domain name (example.com) into an internet protocol (IP) address (something like 123.345.567.789).&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.seobility.net%2Fen%2Fwiki%2Fimages%2Fd%2Fd0%2FDNS-Server.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.seobility.net%2Fen%2Fwiki%2Fimages%2Fd%2Fd0%2FDNS-Server.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ports 25: SMTP, 110: POP3, &amp;amp; 143: IMAP&lt;/strong&gt;&lt;br&gt;
SMTP (Simple Mail Transfer Protocol), POP3 (Post Office Protocol), and IMAP (Internet Message Access Protocol) are used to manage the sending and receiving of digital mail to and from a mail server.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw734o2mmuzts9bq8ninf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw734o2mmuzts9bq8ninf.jpg" alt="email protocols"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More specifically, IMAP and POP3 are most commonly used for retrieving emails and STMP is used for sending emails across the Internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port 123: NTP&lt;/strong&gt;&lt;br&gt;
The NTP (Network Time Protocol) is an interesting protocol to me because it is one of the oldest protocols used and is generally only used for clock synchronization between computer systems over packet-switched, variable-latency data networks. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Fc%2Fc9%2FNetwork_Time_Protocol_servers_and_clients.svg%2F220px-Network_Time_Protocol_servers_and_clients.svg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Fc%2Fc9%2FNetwork_Time_Protocol_servers_and_clients.svg%2F220px-Network_Time_Protocol_servers_and_clients.svg.png"&gt;&lt;/a&gt;For example, most modern operating systems support NTP as a basis for keeping an accurate clock.&lt;/p&gt;

&lt;h1&gt;
  
  
  How it all comes together
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;When your Browser makes a request for a page it will take any data associated with the request and make package it together in a "packet" that it will send to its associated Transport Layer protocols (TCP or UDP).

&lt;ul&gt;
&lt;li&gt;If the data is too large each layer will break the data into chunks called "packets" that will each travel to the destination in the same process.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Once at the Transport Layer protocol, the defined protocol will add on a TCP Header containing its own specific information about the destination, length, padding, special options, and more depending on if it is a UDP or TCP based request. Then the Transport Layer protocol will send the new packet of data to the Internet/Network layer (see the OSI model for more info)&lt;/li&gt;
&lt;li&gt;Now at the Internet Layer the packet the protocol will add on the IP Header and make a Datagram frame that it will be sent to the DataLink layer.&lt;/li&gt;
&lt;li&gt;At the DataLink layer the rest of the original frame is encapsulated into a new frame the associated headers (MAC Header and LLC Header) and footers (FCS footer) are added before it is sent over the communication channel of the Physical Layer.&lt;/li&gt;
&lt;li&gt;Once the intended device receives the data the opposite actions are performed according to its intended use.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.computernetworkingnotes.org%2Fimages%2Fcisco%2Fccna-study-guide%2Fcsg25-03-tcp-ip-encapsulation.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.computernetworkingnotes.org%2Fimages%2Fcisco%2Fccna-study-guide%2Fcsg25-03-tcp-ip-encapsulation.png"&gt;&lt;/a&gt;&lt;/p&gt;
Image from Computer Networking Notes in link 10 below



&lt;h1&gt;
  
  
  Why should you care?
&lt;/h1&gt;

&lt;p&gt;The need to understand protocols is important to make sure that you are using the correct protocol for your need and you are not using protocols that have other intended uses. There are a lot of protocols available and there is no need to reinvent the wheel if you can learn how to use it properly. (Read the &lt;a href="https://tools.ietf.org/" rel="noopener noreferrer"&gt;RFCs&lt;/a&gt; for protocol standards.) Not understanding protocols and their use can lead to broken access issues or leaking date that might be accessible through a different protocols than intended.&lt;/p&gt;




&lt;p&gt;Happy Hacking&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgsiwm8b52w3ci2sn5b3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgsiwm8b52w3ci2sn5b3.gif" alt="Happy Hacking"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/People/Frystyk/thesis/TcpIp.html" rel="noopener noreferrer"&gt;https://www.w3.org/People/Frystyk/thesis/TcpIp.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://searchnetworking.techtarget.com/definition/TCP-IP" rel="noopener noreferrer"&gt;https://searchnetworking.techtarget.com/definition/TCP-IP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tools.ietf.org/html/rfc1122" rel="noopener noreferrer"&gt;https://tools.ietf.org/html/rfc1122&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tools.ietf.org/html/rfc7540" rel="noopener noreferrer"&gt;https://tools.ietf.org/html/rfc7540&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://searchnetworking.techtarget.com/definition/UDP-User-Datagram-Protocol" rel="noopener noreferrer"&gt;https://searchnetworking.techtarget.com/definition/UDP-User-Datagram-Protocol&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://searchnetworking.techtarget.com/definition/domain-name-system" rel="noopener noreferrer"&gt;https://searchnetworking.techtarget.com/definition/domain-name-system&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.knoldus.com/still-not-switch-to-http-2/" rel="noopener noreferrer"&gt;https://blog.knoldus.com/still-not-switch-to-http-2/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.rfc-editor.org/rfc/rfc7230.txt" rel="noopener noreferrer"&gt;https://www.rfc-editor.org/rfc/rfc7230.txt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sectigostore.com/blog/port-443-everything-you-need-to-know-about-https-443/" rel="noopener noreferrer"&gt;https://sectigostore.com/blog/port-443-everything-you-need-to-know-about-https-443/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.computernetworkingnotes.com/ccna-study-guide/data-encapsulation-and-de-encapsulation-explained.html" rel="noopener noreferrer"&gt;https://www.computernetworkingnotes.com/ccna-study-guide/data-encapsulation-and-de-encapsulation-explained.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h6&gt;
  
  
  Please Note: that I am still learning and if something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
&lt;/h6&gt;

</description>
      <category>todayilearned</category>
      <category>codenewbie</category>
      <category>browser</category>
      <category>security</category>
    </item>
  </channel>
</rss>
