- Create ec2 instace to install wp using bitnami ami. we used this ami - this is apache2
- You can now ssh to machine and get your credentials by
sudo cat /home/bitnami/bitnami_credentials - Login using crendials at http://ip/wp-admin
- Follow some inital setup steps here
- Install SSL certificate by this command
sudo /opt/bitnami/bncert-tool( Details here ) (redirect http to https)
- Go to cloudfront distribution
- Add origin -> blog.hcode.tech, Https only
- Add behavior -> blog/, point to above origin and redirect http to https and choose Cache policy as CachingDisabled
- Add behavior -> blog/*, point to above origin and redirect http to https (Make sure
blog/has higher precedence thenblog/*)
sudo vim /opt/bitnami/wordpress/wp-config.phpand modify below lines
define( 'WP_SITEURL', 'https://blog.hcode.tech/blog' );
define( 'WP_HOME', 'https://www.hcode.tech/blog' );
- Modify rewrite rules
2a. Apache2:
sudo vim /opt/bitnami/apache2/conf/vhosts/wordpress-https-vhost.confAdd below line after theRewriteRule ^bitnami/wordpress(/.*) $1 [L]line
RewriteRule ^blog(/.*) $1 [L]
or 2b. Nginx: sudo vim /opt/bitnami/nginx/conf/server_blocks/wordpress-https-server-block.conf
Add below line
rewrite ^/blog(/.*) $1 last;
- Finally
sudo /opt/bitnami/ctlscript.sh restart
to access phpmy-admin, create tunnel
ssh -N -L 8888:127.0.0.1:80 hcode-blog
where hcode-blog is the name of ssh connection
then open:
http://127.0.0.1:8888/phpmyadmin/
user: root
password is same as application passowrd, accessible at sudo cat /home/bitnami/bitnami_credentials