Sep 7

AWS Strategy – Webpage Server


SECURITY GROUPS – Create one for each service (isolate IPs accordingly)
RDS instance (mysql – set security group to only MySQL)
EFS instance (keep logs .conf and http files)
EC2 instance (the engine that runs the show)
Linux login – log in with new .pem file
Linux update – sudo yum -y update
Linux EFS – create mount directory /mnt/
Linux EFS – sudo yum -y install nfs-utils
Linux EFS – sudo
Linux EFS – ensure mount worked with df -h
Linux EFS – Create persistent mount in /etc/fstab file
Linux SQL – sudo yum -y install mysql
Linux SQL – connect to RDS
Linux SQL – create new database, grant privs
Linux Apache – create new URL folder in EFS location
Linux Apache – configure httpd for EFS locations
Linux Apache – auto start service on boot
Linux Apache – Check connections with a browser (both http and https)
Linux Files EFS – /mnt/dir/var/log/httpd/ (technique only)
Linux Files EFS – /mnt/dir/etc/httpd/conf.d/ (technique only)
Linux Files EFS – /mnt/dir/var/www/html/virtuals/ (technique only)
Migrate files from old server as needed
Linux Permissions – chown apache:apache to each URL folder
Linux Permissions – chmod 0644 to all files
Linux Permissions – chmod 0755 to all directories
Linux Permissions – use this script if needed
Connect RDS – use a connection script to connect and log activity
SQL – create database
SQL – Grand Privileges
SQL – Flush Database and exit
Wordpress – download files / unzip files
Wordpress – copy/create wp-config.php
Wordpress – configure WordPress for RDS/SQL connection
TEST – go to your new URL and make sure everything works

APACHE PROBLEMS: The connection to the database is an issue with the default version of httpd on the Amazon Linux install. Creating a .conf for one WordPress website (using all private connection addresses) works fine. When a second .conf is created for a new URL, and the httpd service is restarted, only the last .conf is registered for the server. DNS will resolve to the server, but apache only serves the last .conf that was loaded. The error is:
“Starting httpd: [Thu Sep 07 17:11:44 2017] [warn] _default_ VirtualHost overlap on port 80, the first has precedence”
ANSWER: By default, the variable “NameVirtualHost *:80” is commented out with a “#” in front of it. Remove the “#” so that apache knows that it will serve more than one site.