Your Name 8 mesi fa
parent
commit
9d71f83c83
1 ha cambiato i file con 74 aggiunte e 0 eliminazioni
  1. 74 0
      README.md

+ 74 - 0
README.md

@@ -1,4 +1,78 @@
 # kyleguy
+There are a few things that need to be setup to have a website.  One needs a domain.  This is just a name that people use to identify something.  Google owns many domains, for example: `www.google.com`, `google.com`, `gmail.com`.  These domains have various meanings to different people, but to you `google.com` probably means a website where one can find other websites, products, services, etc on the Internet.  We need a domain.  We need a place for our website to exist, we are going to host our website at `pebbleguy.com`.  We also need a way to edit our site.  These three things are really all that we need, each might abstract some difficulties, but nothing is too complex.  For example to have a domain we need to manage the Domain Name System, it is easy albeit esoteric.
+
+## a place called home, or maybe webroot
+Base directory.  Home.  Root.  C Drive.  What other names are there? Maybe `A:` or `/`.  The place that is the container for the stuff.  Or the directory that holds all the files.  Folders if you like that better.  The `webroot` is a name that does not mean anything except for when you care about it.  If it were your job to organize a party you'd probably pick a place and tell everyone to meet there.  For this tiny amount of time that location is special.  It is ground zero for where the party will happen.  People who aren't at the specified location aren't at the party.  Your party isn't the only party.  In fact it might not even be the only party at the location that you picked.  The point is that you picked a location made it special because you said it was.  This is the same for a webroot.  You are just picking some arbitrary location on a disk and you are going to tell everyone if they want to party at your website they need to go there.  When you follow the instructions for the site setup you will need to tell `NginX` about this location.  I am going to pick the location and we are going to put some files there to serve up at the party.  How long can I draw out this metaphore?  Forever.
+
+Our `webroot` is going to be `/mnt/external/websites/kyleguy.rome7.com`.  We are going to store files in an adjacent directory, further explained when we do the site setup.  This directory that actually contains all the `.html` files and cool pictures of cats is going to be `/mnt/external/projects/kyleguy/public`.  And `/mnt/external/projects/kyleguy`  that is this repository.  There is a copy of this `README.md` in `/mnt/external/projects/kyleguy/README.md`.  Whoa trippy.  Lets put this `README.md` there.
+
+```
+cd /mnt/external/projects
+git clone https://git.pebbleguy.com/kyle/kyleguy
+```
+
+Public does not exist yet.  Let's create it.  We are hosting a static site generated by a tool called `hugo`.  We need `hugo`.  One would be better off developing their site on their computer.  So let's use Windows because I loath the OS and like maximum pain.
+
+## site setup
+You are going to need a domain, either buy one or be a person whom already has a domain.  We are going to host our site on `pebbleguy.com` using the `NginX` ("engine x") web server.  We will create a site configuration file with SSL using a tool, `certbot-wapper.sh`.  This script is part of the [pebbleguy repository](https://git.pebbleguy.com/Dan/pebbleguy.com/src/master/scripts/certbot-wrapper.sh).  Login to your account on `pebbleguy.com` using Secure Shell (SSH) or ask Kyle, Chris, Daniel, or Emma for help.  If you are one of those people, hello!  Download the `pebbleguy.com` repository so you have access to the script and run `certbot-wrapper.sh` to have it create the `NginX` config file for your site:
+```
+git clone https://git.pebbleguy.com/Dan/pebbleguy.com
+cd pebbleguy.com/scripts
+./certbot-wrapper.sh -h kyleguy.rome7.com -u kyle
+```
+
+This should create a configuration file either on the external disk or primary disk depending on if `pebbleguy.com` is in `Read-Only` or `Read-Write` mode.  More info on that [here](https://git.pebbleguy.com/Dan/pebbleguy.com#persistent-storage).  The locations are either `/mnt/external/live-server-configs/for-nginx/sites-enabled/kyleguy-web.conf` or `/etc/nginx/sites-enabled/kyleguy-web.conf`.
+
+Keep those file locations in mind for later.
+
+When I ran `certbot-wrapper` the system was in `Read-Write` mode so my config was created `/etc/nginx/sites-enabled/kyleguy-web.conf`:
+```
+server {
+        server_name kyleguy.rome7.com;
+        # listen 80;
+        listen 443 ssl;
+        index index.php;
+        root /mnt/external/websites/kyleguy.rome7.com/;
+
+        location / {
+            # first attempt to serve request as file, then as directory, then fall back to displaying a 404.
+            try_files $uri $uri/ =404;
+        }
+
+        # reverse proxy for initial certbot http challenge (we have certbot listen on 888)
+        # include /etc/nginx/includes/certbot-web-plugin.conf;
+
+        # include php by default
+        include /etc/nginx/includes/php-location-directives.conf;
+
+        ssl_certificate /mnt/external/live-server-configs/letsencrypt/live/kyleguy.rome7.com/fullchain.pem;
+        ssl_certificate_key /mnt/external/live-server-configs/letsencrypt/live/kyleguy.rome7.com/privkey.pem;
+        # include /etc/nginx/snippets/ssl-params.conf;
+}
+```
+
+Now we need to create a directory to store our site.  You'll notice in the generated config file it has some defaults choosen for us, `root /mnt/external/websites/kyleguy.rome7.com/;`.  It hasn't actually done any of the work it is meant only to bootstrap a config file and retrieve SSL certificates for `https`.  If you use your SSH connected terminal to navigate to the external drive you will see a projects directory:
+```
+cd /mnt/external
+ls
+```
+
+will show:
+```
+username@pebbleguy:/mnt/external $ cd /mnt/external
+username@pebbleguy:/mnt/external $ ls
+gogs  live-server-configs  lost+found  projects  websites
+```
+
+You will put your site repository into the `projects` directory.  You will also notice a `websites` directory.  You could put your website there, but you'd get caught in an organizational nightmare.  Instead we will put a sort of shortcut into the `websites` directory that points to the actual website directory that is contained in our repository.  This way we don't ever need to come back to this terminal on `pebbleguy.com` to mess around with our files ever again, probably.
+```
+username@pebbleguy:/mnt/external $ cd /mnt/external
+username@pebbleguy:/mnt/external $ ls
+gogs  live-server-configs  lost+found  projects  websites
+username@pebbleguy:/mnt/external $ sudo ln -s /mnt/external/projects/kyleguy/public/ /mnt/external/websites/kyleguy.rome7.com
+username@pebbleguy:/mnt/external $ ls /mnt/external/websites
+emma-kac  gogs-webhooks  KingsAndChaos  kyleguy.rome7.com  shootGame  www.pebbleguy.com
+```
 
 ## repository setup