Web Server Preparations


In the pages that follow, you will find this isn't the simplest way to set up a website in your own home, office, or MAAS location, however it is a fairly secure way to set things up. I don't think it's DoD secure, but it's really good.

In today's world I don't see any reason for any entity—be they a individual with a paper plane building blog or a corporation—to have an unsecured server.

1/2/2018 Update on Composer installation and use

Composer is a software handler/installer/etc. that has become very popular and I use it in many of the following pages to install, modify & maintain them. Since I started making this "how--to" site the way I installed and used Composer has changed drastically, so I'm using this page as the place to display my composer how-to.

Installation

See the official Composer page for details, but I've seen a few other ways to go about it. One is with shell commands, another at "How do I install Composer programmatically?" is by doing a shell script file, and they hyperlink you to another method still. However, I think the APT way is best the official Composer page way is the best.

  • Open a shell window that's you as your user account that you assigned yourself when you set up your server. You can do it how I've shown in other videos like Put the APC Monitoring Module in Webmin. It's important that you aren't doing this as root, or with the sudo command. You want to be sure you are in your own /home/<your user name>/ directory.
  1. mkdir bin
  2. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  3. php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    • You should see "Installer verified" if things worked, and "Installer corrupt" if something's wrong with the key matching the software downloaded by copy. The "Installer corrupt" message indicates that the installer program gets un-linked so that it wont actually install.
    • Please be advised the the key in the last statement will change over time and you should only use the one from that https://getcomposer.org/download/ page.
  4. php composer-setup.php --install-dir=bin --filename=composer --version=1.5.2
    • For me that output:
      • All settings correct for using Composer
      • Downloading...

      • Composer (version 1.5.2) successfully installed to: /home/<your user name>/bin/composer
      • Use it: php bin/composer

    • Note that I picked the highest version at the time. Also note that you could skip the bin part if you wanted to save keystrokes when running it.
  5. php -r "unlink('composer-setup.php');"
  • To see what commands you can add to the composer program, from your home directory enter the php bin/composer command. Using composer in general though, from a folder where you see a composer.lock file you may execute, php ~/bin/composer install, or perhaps php /<full path to your home directory>/bin/composer update and so on and so forth.