Working with Amazon (AWS)
Lightsail - virtual private server instances - $5 for 512gb instance/month
Setting up SSH - trying to use my own ssh keys.
- Logging in
- Change key permissions.
chmod 600 KEYFILE
ssh -i KEYFILE ubuntu@ip-address
PHP Wordpress config
php7.0 php7.0-cli php7.0-fpm php7.0-mysql php7.0-xml php7.0-mbstring php7.0-zip php7.0-gd php7.0-curl php-imagick mysql-server git nginx
- Install composer.
- Follow instructions from composer
- Configure nginx and php7.0-fpm
- nginx - configure default virtual environment
- Enable php7.0-fpm in configuration.
- Create rsa key to share with bitbucket or github
ssh-keygen -t rsa - no password
- Add a deployment key to github to pull code to server.
- Configure nginx
- Setup mysql database
- Download composer and wordpress command line.
mv composer.phar /usr/local/bin/composer after install
Upgrading Ubuntu Service
- Restart service
sudo nginx -t - test config
sudo systemctl restart nginx
sudo systemctl retart php7.0-fpm
- Certbot - Ubuntu
- Port 443 needs to be open
- Domains need to be in nginx.conf file (sites-enabled/default) file.
- Pretty straightforward and easy to set up.
Amazon Identity and Access Management
- Create user to access S3 and Cloudfront - will be used to upload files to S3
- IAM Management Console
- Create User
- Give S3, CloudFront and APIGateway settings
Setting up S3 and CloudFront for paseo.org.za
- Create ssl/tls certificate
- Create the certificate in N. Virginia else it won't work.
- Make sure that you have access to one of the email addresses that Amazon will use for verification
- Add a domain name - .paseo.org.za/paseo.org.za and .martinsonline.org/martinsonline.org
- Create S3 Bucket
- Use basic settings. Going to use this bucket as source for CloudFront
- Upload site with Cyberduck to s3
- Create Bucket Policy
- Create CloudFront Distribution
- Web delivery method
- Create certificate with Certificate Manager
- Don't forget to enter the cname record.
- Use either both http and https or redirect http to https.
- Update DNS records
- Add CNAME record to dns record
- www points to cloudfront url
- Be sure to include root document - index.html - for it to work correctly.
Issues with deployment on LightSail
- Error PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
Adding API Theme
- Adding a public theme to show when hitting the front page of our api.