Getting started with Amazon Web Services EC2(Elastic Compute Cloud)
Very first you have to create an account in Amazon.com with valid credit card and then activate micro free tie. Click here to access Amazon console dashboard.
Step 1
After Amazon console login you find the following screen, select EC2 from Compute category.
Step 2
Click Launch Instance button.
Step 3
Now choose operating system for your web server, I suggest use Ubuntu
for more package advantages. Make sure, that should be listed in free
tier.
Step 4
You find the following screen, now click Launch button.
Step 5
Here you can modify your server type, but initially explore things with free tier.
Creating Amazon Key File - Authentication
Most important part in this installation process. Step 6
Here choose Create a new pair key
Step 7
Give valid name and click to Download Key Pair. You will get an .pem file.
Step 8
Instance has been created successfully.
Firewall Security Settings
Step 9
You will find the instance status here.
Step 10
Select the instance box and scroll down the page, you will find inbound rules for firewall security
Step 11
Add HTTP rule for web server access.
Elastic IP - Create Static IP Address
Basically Amazon instance will provide you a dynamic public DNS name, this is not stable. So you need a static IP.Step 12
Go to Network & Security category and select Elastic IPs, click Allocate New Address
Step 13
Amazon will provide you a random IP address.
Step 14
Now associate IP address with instance box.
Step 15
Choose instance box here.
Step 16
Click Associate address. Associated IP address with instance.
Linux & MAC connection
Executing following command with Linux or MAC terminal, you can directly access your box.
ssh -i keyname.pem ubuntu@IP_ADDRESS
Sometimes you will get following error.
Permissions 0640 for 'keyname.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "keyname.pem": bad permissions
Permission denied (publickey).
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "keyname.pem": bad permissions
Permission denied (publickey).
Give only READ permission for .pem file, then execute SSH command again.
sudo chmod 400 keyname.pem
Windows connection
You have to download Putty and PuttyGen softwares. Click this Amazon Windows Connectivity link, follow steps under Windows connect using Putty
ubuntu@ip-172-31-19-204:~$ sudo su
root@ip-172-31-19-204:/home/ubuntu#
root@ip-172-31-19-204:/home/ubuntu#
This will update Ubuntu OS Packages
sudo apt-get update
Stop Default Apache
sudo /etc/inid.d/apache stop
XAMPP Installation Commands for Ubuntu
Download XAMPP for 64 bit
wget http://sourceforge.net/projects/xampp/files/XAMPP%20Linux/1.8.3/xampp-linux-x64-1.8.3-5-installer.run
Make Execute Installation
sudo chmod +x xampp-linux-x64-1.8.3-5-installer.run
Run Installation
sudo ./xampp-linux-x64-1.8.3-5-installer.run
XAMPP instructions
Select the components you want to install; clear the
components you do not want to install. Click Next when you are ready to
continue.
XAMPP Core Files : Y (Cannot be edited)
XAMPP Developer Files [Y/n] : Y
Is the selection above correct? [Y/n]: Y
Installation Directory
XAMPP will be installed to /opt/lampp
Press [Enter] to continue:
Do you want to continue? [Y/n]:Y
XAMPP Core Files : Y (Cannot be edited)
XAMPP Developer Files [Y/n] : Y
Is the selection above correct? [Y/n]: Y
Installation Directory
XAMPP will be installed to /opt/lampp
Press [Enter] to continue:
Do you want to continue? [Y/n]:Y
Run XAMPP
sudo /opt/lampp/lampp start
XAMPP Access Forbidden
Open your browser and access http://IP-ADDRESS/ you will find this Access forbidden screen.
XAMPP Configurations
Edit XAMPP configurations.
vi /opt/lampp/etc/extra/httpd-xampp.conf
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
to
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
Allow from all
Allow from ::1 127.0.0.0/8 \
fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
fe80::/10 169.254.0.0/16
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
to
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
Allow from all
Allow from ::1 127.0.0.0/8 \
fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
fe80::/10 169.254.0.0/16
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
Restart XAMPP
sudo /opt/lampp/lampp restart
Security Settings
sudo /opt/lampp/xampp security
XAMPP: Your XAMPP pages are NOT secured by a password.
XAMPP: Do you want to set a password? [yes]
XAMPP: Your XAMPP pages are NOT secured by a password.
XAMPP: Do you want to set a password? [yes] no
XAMPP: MySQL is accessable via network.
XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes] yes
XAMPP: Turned off.
XAMPP: Stopping MySQL...ok.
XAMPP: Starting MySQL...ok.
XAMPP: The MySQL/phpMyAdmin user pma has no password set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Password:*******
XAMPP: Password (again):*******
XAMPP: Setting new MySQL pma password.
XAMPP: Setting phpMyAdmin's pma password to the new one.
XAMPP: MySQL has no root passwort set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Write the password somewhere down to make sure you won't forget it!!!
XAMPP: Password:*******
XAMPP: Password (again):*******
XAMPP: Setting new MySQL root password.
XAMPP: Change phpMyAdmin's authentication method.
XAMPP: The FTP password for user 'daemon' is still set to 'xampp'.
XAMPP: Do you want to change the password? [yes] no
XAMPP: Done.
XAMPP: Do you want to set a password? [yes]
XAMPP: Your XAMPP pages are NOT secured by a password.
XAMPP: Do you want to set a password? [yes] no
XAMPP: MySQL is accessable via network.
XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes] yes
XAMPP: Turned off.
XAMPP: Stopping MySQL...ok.
XAMPP: Starting MySQL...ok.
XAMPP: The MySQL/phpMyAdmin user pma has no password set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Password:*******
XAMPP: Password (again):*******
XAMPP: Setting new MySQL pma password.
XAMPP: Setting phpMyAdmin's pma password to the new one.
XAMPP: MySQL has no root passwort set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Write the password somewhere down to make sure you won't forget it!!!
XAMPP: Password:*******
XAMPP: Password (again):*******
XAMPP: Setting new MySQL root password.
XAMPP: Change phpMyAdmin's authentication method.
XAMPP: The FTP password for user 'daemon' is still set to 'xampp'.
XAMPP: Do you want to change the password? [yes] no
XAMPP: Done.
PhpMyAdmin
Access PhyMyAdmin at http://IP-Address/phpmyadmin/
Domain Settings
If you own a domain address, go to domain DNS(Domain name settings). Add host value @ points to IP-AddressYou can also convert the key using putty for MAC or Linux
sudo port install putty
This will also install puttygen. To get puttygen to output a .PEM file:
puttygen keyname.ppk -O private-openssh -o keyname.pem
File Uploads
Download here and install into your PC. Click this Amazon FileZilla Connectivity link, follow steps under FileZilla - File Uploads Copy your project folder from /home/ubuntu/ directory to XAMPP htdocs folder.
sudo cp -R WebProjectFolder /opt/lampp/htdocs/
Domain Redirection using .htaccess
Create a .htaccess file and copy into /opt/lampp/htdocs/ directory.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$
RewriteCond %{REQUEST_URI} !^/WebProjectFolder/
RewriteRule (.*) /WebProjectFolder/$1
RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$
RewriteCond %{REQUEST_URI} !^/WebProjectFolder/
RewriteRule (.*) /WebProjectFolder/$1
Now access your domain http://YourDomain.com/
No comments:
Post a Comment