Amazon Web Services – How to Host a PHP Application – Processwire App in AWS


Cloud Services are in the air for a while now, the very business idea changed the way of conventional Corporate world from its core. If you want to know what exactly a cloud service works ( AWS for instance ) , this is a good video series  explains the basic structure.

AWS provides very  rich arsenal suitable to run from  SMB to top notch Corporate Business organization.  It has Server Apps, Media tools, analytic tools, Scaling Tools and what not… Its very very rich in features. But the catch is you pay as you use them. In the conventional business model, you will have to invest a lot for setting up the server station and other tools but some times you wont get the clientèle as you expect, then that investment will be gone. Here, you start from the basic, go as you use or come back down if your business gets into drought and you can go up again later.

Here in this picture, you can see the list of tools, a lot of them will come out if you explore further.

console.aws.amazon.com

AWS gives you a Free Tier package, which is you can use some set of tools completely free for 12 months. You can read further about FreeTier here. It is the best way to start using AWS services.

Now, assume you have setup a free-tier account in AWS and lets see how to host a simple PHP website.

1. Log in with your free tier account

2.  Go to services -> choose EC2 to create virtual instances

3. Create virtual instance ( This is like a creating a server OS instance for you – in my case I choose Ubuntu 16 LTS version of Server which is in the free tier package – you make sure the Virtual Server OS instance you select should be in the Free Tier pack)

4.  Allocate new Elastic IP

5. Connect it with new Virtual Instance

Steps 1 to  5 could be a little confusing here, so I suggest to watch this video for a visual tutorial. It helped me.

So once you setup your Server OS instance, its time to configure with LAMP stack. Its a straight forward setup, for any confusion, look at here :  

If you are fond of PhpMyAdmin as your Database Manager, install it too.

At this point, you must be introduced to your elastic IP Address, your AMAZON private key and all. So use the SCP way to  transfer your PHP website / app into the server, then access it via your http://www.ipaddress/your_appfolder

In my case, I did an

SCP copy scp -i myamazonkey.pem /home/jeevs/Downloads/soft/processwire-master.zip    ubuntu@myamazonIP:~/.

Then I extracted the PW into my /var/ww/html/public_html/pw. So I could access http://www.myip/pw . I imported the database using  http://www.myip/phpmyadmin.  So if you want to edit any files in the server, you can use the SSH command and edit files using nano

ssh -i “myamazonprivatekey.pem” ubuntu@myamazonip

The last step is to map the domain with your hosting IP address.  You can register a new domain with AWS or you can map the existing one to the hosting. For an existing domain name in Godaddy, you can assign the IP address to Godaddy DNS settings.

You can assess www.yourdomainname.tld/your_appfolder

Voila, you have hosted your first PHP App in Amazon Web Hosting.  Here is one simple ProcessWire website I have done.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.