Jump to content

Build website on AWS Lightsail


Cowboy Denny
 Share

Recommended Posts

Going to test moving this website or my gearcrushers website to AWS using the LightSail product.  Now I know the danger of doing this is you don't have any support.  I currently host my websites on LiquidWeb and when I run into any issues or concerns I can contact the support which all speak very clear English and are more than willing to help but I have this itch to host a website in the cloud and AWS is the cheapest between AWS and GCP (not even slightly interested in using a Microsoft product "Azure").  You can use other cloud companies like Digital Ocean but it "feels like" there is much more support for AWS version even though its slightly more expensive.  I'm using the AWS Lightsail 3month free trial which by then I'll know if its worth keeping or not.

I'm most familiar with CentOS but since the announcement that CentOS is no longer supported (unless its the stream version) I don't want anything to do with building up my site to just be told to double the effort since now you have to migrate off that non supported system onto something that is supported.

I started off trying to pick Ubuntu 20 and then when I do an upgrade to 22 it breaks the Web Console SSH session.  I can still do SSH via my terminal or ZOC but the web console is just a no go.  I cleared cache, cookies of the browser and I went through all the suggestions on there help page and nothing worked so I am giving up using Ubuntu as my Instance.

I loaded the Amazon Linux 2 instance since it says the security is managed by Amazon (so upgrades I shouldn't have to worry about as much).  Now the downfall is no one on the internet is going to provide tips and tricks on how to do anything on the Linux2 version created by Amazon unlike big names like Ubuntu, CentOS and Debian.

Validate what version of Linux you are using:

cat /etc/system-release

Instructions on how to build Website on AWS LInux2 instance in AWS Lightsail

Install LAMP (Linux, Apache, MariaDB, PHP)

sudo yum update -y

Before installing if you would like more info about the package just run:

yum info package_name

 

sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.4 php7.4

sudo yum install -y httpd mariadb-server

 

Start Apache

sudo systemctl start httpd

 

Set Apache to start with every reboot

sudo systemctl enable httpd

 

Verify httpd is running

sudo systemctl is-enabled httpd

 

Do you have website uploaded to /var/www/html?  If not when you go to your IP address you should get the Apache default page.

Add the ec2-user to the apache group

sudo usermod -a -G apache ec2-user

NOTE: You'll need to logout and back in for the new group membership to take effect and when you type groups you should see you are a member of apache now.

 

Once you upload all your files to /var/www/html you need to update ownership

sudo chown -R ec2-user:apache /var/www

 

Then you need to provide write access

sudo chmod 2775 /var/www && find /var/www -type d -exec sudo chmod 2775 {} \;

find /var/www -type f -exec sudo chmod 0664 {} \;

 

Create a php file

echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php

 

In a browser go to the IP address/phpinfo.php and you should see the PHP info page

 

Once you can see the phpinfo.php successfully, delete it since it offers more info then the public needs to see: rm /var/www/html/phpinfo.php

 

Secure the Database

sudo systemctl start mariadb

 

 

 

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...