Skip to content

Instantly share code, notes, and snippets.

@thegrid22593
Created November 28, 2018 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thegrid22593/5e653d71ab872f7761bf3737f6c07105 to your computer and use it in GitHub Desktop.
Save thegrid22593/5e653d71ab872f7761bf3737f6c07105 to your computer and use it in GitHub Desktop.

SSH Into Server

Be in the foler that the certificate is in or else write the path to certificate. Dont include '[ ]'

CD into folder containing SSH Key

ssh bitnami@[ip-address] -i [name-of-certificate]

If you get an error about the certificate being insecure, cd into the directory that the certificate is located in and run the following:

sudo chmod 600 [name-of-the-cert]` (Remove the brackets when writing in terminal)

Then try the first instruction again.

Check Admin Password

cat bitnami_application_password

Accessing PhpMyAdmin on Linux and Mac OSX

  1. ssh -N -L 8888:127.0.0.1:80 -i KEYFILE bitnami@SERVER-IP

  2. Then go to: http://127.0.0.1:8888/phpmyadmin/

  3. Login with username: root and password is the bitnami application password in the bitnami folder on the server. FTP into the server to get it. It will be different for every instance.

  4. Once in the database, create a new database for wordpress and a user for the database

Permissions Overall (Must do to get image uploading, plugin updates)

Every Folder in wp-content ( Root ) 775 bitnami:daemon

cd into the root directory

sudo chown -R daemon:bitnami htdocs/
sudo find htdocs/ -type d -exec chmod 775 {} \;
sudo find htdocs/ -type f -exec chmod 664 {} \;

Email Setup MX Records

Emails do not use www in their domain lookup, so you must specify the root domain

  • Type MX
  • Subdomain: (no www) - domain.com
  • Priority: 1
  • Destination: Mail Server

Start/Stop Web Server

Stop Server sudo /opt/bitnami/ctlscript.sh stop

Start Server sudo /opt/bitnami/ctlscript.sh start

Caching during development

By default lightsail has a pretty hardcore cache which is one of the reasons its so fast. During development this is annoying because the files take a while to refresh after a new upload to the ftp. During development edit line 1906 of the php.ini file to have the opcache.enable=0 instead of 1. Once going live this should be turned back on with a value of 1.

Location of php.ini /opt/bitnamii/php/etc/php.ini

Location of httpd.conf /opt/bitnami/apache2/conf/httpd.conf

comment out lines 526 and 527

Include conf/pagespeed.conf

Include conf/pagespeed_libraries.conf

Now restart the Server

Lets Encrypt SSL Setup

https://docs.bitnami.com/aws/how-to/generate-install-lets-encrypt-ssl/

If you want to use (www) in your domain then you need specify www.example.com for any reference of DOMAIN in the instructions above.

Lets Encrypt SSL Renewal Setup

  1. SSH into the server ssh bitnami@server-ip -i keyfile
  2. Stop the server sudo /opt/bitnami/ctlscript.sh stop
  3. Run pico editor sudo pico
  4. Enter This info
sudo /opt/bitnami/ctlscript.sh stop apache
sudo /usr/local/bin/lego --email="EMAIL-ADDRESS" --domains="DOMAIN" --path="/etc/lego" renew
sudo /opt/bitnami/ctlscript.sh start apache
  1. Make the script excuitible sudo chmod +x ./renew-certificate.sh
  2. Move the script to the lego folder sudo mv ./renew-certificate.sh /etc/lego/renew-certificate.sh
  3. Set up cron job open contrab sudo crontab -e
  4. Set the job in the file and save it 0 0 1 * * /etc/lego/renew-certificate.sh 2> /dev/null
  5. Start server sudo /opt/bitnami/ctlscript.sh start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment