Install wordpress
WordPress SEO Improvements
26/08/2016
Install load balancer with nginx on ubuntu 14
Install load balancer with nginx on ubuntu 14
16/12/2016
Show all

Install wordpress on amazon lightsail

Install wordpress on amazon lightsail

Login to https://amazonlightsail.com/ 

Create new instance

Select wordpress instance image

Choose your instance plan and Create…

Select the instance and select manage, connect using SSH

To view wordpress password= logon to ssh and run: cat bitnami_application_password

WordPress admin name: user

WordPress folders location: /opt/bitnami/apps/wordpress/htdocs/

WordPress wp-config.php location: sudo nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php

WordPress .htaccess location: sudo nano /opt/bitnami/apps/wordpress/htdocs/.htaccess

Restarting Apache: sudo /opt/bitnami/ctlscript.sh restart apache

Restarting Ngnix: sudo /opt/bitnami/ctlscript.sh restart nginx

Restarting Server: sudo shutdown -r now

allow access to phpmysql fron anywhare: sudo nano /opt/bitnami/apps/phpmyadmin/conf/httpd-app.conf

Restarting Apache: cd /opt/bitnami
sudo ./ctlscript.sh restart apache

phpMyAdmin password: sudo nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php

Allow access from ip:

 

Restarting Apache: cd /opt/bitnami
sudo ./ctlscript.sh restart apache

Disable bitnami manager icon: sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1

apache log: cd /opt/bitnami/apache2/logs/

Fix uploaded file could not be moved to wp-content:

sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs/wp-content
sudo chmod -R g+w /opt/bitnami/apps/wordpress/htdocs/wp-content

Fix permalink
add . (dot ) to home url

Restore web from S3

goto s3 bucket and download backup zip file & backup sql file
make files as public

EC2 Shell: cd /var/tmp/
download web.backup.files.zip: wget public-link.zip
download sql.backup.file.sql: wget public-link.sql
rename zip content file to web.zip: sudo mv /var/tmp/*.zip /var/tmp/web.zip
rename sql db file to db.sql: sudo mv /var/tmp/*.sql /var/tmp/db.sql
sudo apt-get install unzip
mkdir web && mv /var/tmp/web.zip /var/tmp/web
cd /var/tmp/web/ && sudo unzip web.zip && mv web.zip /var/tmp/
sudo rm -rf /opt/bitnami/apps/wordpress/htdocs/*
sudo rm /opt/bitnami/apps/wordpress/htdocs/.htaccess
sudo mv -v /var/tmp/web/var/www/html/* /opt/bitnami/apps/wordpress/htdocs/

Import mysql database

mysqladmin password: cat bitnami_application_password

mysqladmin -u root -p create wordpress

sudo mysql -h localhost -u root -p --max_allowed_packet=1073741824 wordpress < /var/tmp/db.sql

Change DB Name & User: sudo nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php

Change website url in PHPmyAdmin ( only for a new domain )

logon to http://EC2_IP/phpmyadmin
wp_options
change to EC2_IP

by command: ( change domain-name )

sudo mysql -h localhost -u root -p wordpress

UPDATE wp_options SET option_value = replace(option_value, 'http://domain-name', 'http://EC2-IP') WHERE option_name = 'home' OR option_name = 'siteurl';

Troubleshooting:

Disable plugins ( only for a new domain )

sudo mv /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins-old

and change the WordPress Address (URL) and Site Address (URL).

Fix uploaded file could not be moved to wp-content:

sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs/wp-content
sudo chmod -R g+w /opt/bitnami/apps/wordpress/htdocs/wp-content

Fix WordPress needs to access your web server. (FTP)
sudo nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php
ADD this line: define( 'FS_METHOD', 'direct' );

Redirect non www to www

sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf

DocumentRoot "/opt/bitnami/apache2/htdocs"
ServerName test.com
ServerAlias www.test.com
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
<Directory "/opt/bitnami/apache2/htdocs">

Install free SSL

Download and Install and Active WP Encrypt plugin : https://www.yanivp.net//wordpress.org/plugins/wp-encrypt/

Go to Account Settings
Go to Register Account

FIX Could not create directory /opt/bitnami/apps/wordpress/letsencrypt/live. Please check your filesystem permissions.

sudo mkdir /opt/bitnami/apps/wordpress/letsencrypt
sudo chown bitnami -R /opt/bitnami/apps/wordpress/letsencrypt
sudo chgrp -R daemon /opt/bitnami/apps/wordpress/letsencrypt
sudo chmod 775 /opt/bitnami/apps/wordpress/letsencrypt

Go to Generate Certificate

Click help tabs at the top of this page to set up the ssl

sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf and paste VirtualHost code from Help info

next..
Delete line: SSLCertificateFile “/opt/bitnami/apache2/conf/server.crt”
Delete line: SSLCertificateKeyFile “/opt/bitnami/apache2/conf/server.key”

redirect from http to https://www.yanivp.net

sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf

DocumentRoot "/opt/bitnami/apache2/htdocs"
ServerName test.com
ServerAlias test.com
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*)$ https://www.yanivp.net//www.%{SERVER_NAME}/$1 [R,L]

sudo nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php

change to https

define('WP_SITEURL', 'https://www.yanivp.net//' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'https://www.yanivp.net//' . $_SERVER['HTTP_HOST'] . '/');

Restarting Apache: sudo /opt/bitnami/ctlscript.sh restart apache

Check non https images with this tool:
https://www.yanivp.net//www.whynopadlock.com/

and update the https domain in google webmaster tools

3 Comments

  1. Appreciative User says:

    thank you so much! this helped me get phpMyAdmin going on my lightsail instance.

  2. Jay says:

    user ‘user’ seems to not exist anymore. Only bitnami is there

Leave a Reply

Your email address will not be published. Required fields are marked *