Archive for February, 2012


Am not gonna get into the detailed aspects, just a brief introduction. First you need an Amazon Account. Register for Amazon AWS. You need an instance to to have your Web Server running. You may bundle an AMI and upload it , I prefer the ready made Amazon AMI’s. You can choose between Amazon Linux (or) your favorite distribution. I used the default one provided by Amazon.

1. Install Apache

yum install httpd

2. Set up MYSQL, PHP and other developer packages.

yum install mysql-server mysql php php-devel php*

3. Now allow access for SSH, FTP (you need FTP for loading files to your website), HTTP (22,(21,20),(80,8080)) under Security Groups, you need to write Custom TCP rules for them. It’s very easy you must be able to figure it out, once your familiar with AWS Console.

4. Now create an elastic IP to access your instance on the World Wide Web.

5. Map the IP to your instance.

6. Configure your HTTP and restart your Apache service once your done with it.

7. Make sure you turn on mysql httpd ftp permanently.

chkconfig httpd on

Repeat the same for the other daemons as well.

8. Configure your DNS to map it to your domain. Edit /etc/hosts

10.x.x.x mysamplewebsite.com mysample     (Just an alias)

(The above is just an example provides the syntax of the /etc/hosts file ).

11. Configure your domain to point to this IP.

Your Website is now hosted on the cloud. Yaay !!

You can contact me for any further clarifications or details.

HTH

 

 

 

 

I found it really hard to change the home directory of an FTP user, later discovered that useradd is embedded with the feature of changing the default home directory to something else. Anwyays I learnt it the hard way. It’s pretty easy and so dumb of me that I didn’t find it at the first attempt.

Here you go,

useradd [username] -p [password] -d [directory]

example:

useradd testuser -p test123 -d /opt

Here /opt is the home directory of the user testuser. By default the home directory is set to /home/testuser.

I found it really hard to login to Ubuntu every single time I wanted to configure my EC2 instance. Putty provided me with easy access to my instances using Windows 7.

1. Get PuttyGen and Putty fromthis website

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

I used the 32 bit version.

2. Open Putty Key Generator and select the private key you downloaded for accessing your EC2 instance. Transfer it from Ubuntu.

3. After loading select “Save Private Key”. Give some name (*.ppk)

4. Now open Putty , in the Host type the IP address of the instance . ( I used Elastic IP’s to access my EC2 instances, hence I have my own IP from Amazon ). It’s easy just create an Elastic IP and associate it with the instance.

5.  Under Connection select SSH -> Auth. Select the private key you created in step 3.

6. Now you must be able to login to your instance from Putty.

HTH

<?php

$path = “D:/Refserver 1”;
$dir_handle = @opendir($path) or die(“Unable to open $path”);

echo “<table border=1>”;
echo “<th>File Name</th>”;
echo “<th>SHA1 Hash</th><tr>”;
foreach(glob(‘D:/Refserver 1/*.*’) as $arr)
{
if(is_dir($arr))
{
continue;
}
echo “<td> ” .$arr . “<td>”. sha1_file($arr) . “</td></tr>”;
}
?>