logo
Jese Leos

Helpdice Team

How to deploy PHP App on ubuntu, XAMPP, AWS

Step 1: After Amazon console login, search for EC2 you will get the first option as EC2 Virtual Servers in the Cloud

Step 2: Click Launch Instance button

Step 3: Now choose OS for your web server, We suggest you to use ubuntu for more packages support.

Step 4: Choose AMI - For free only select the image with free tier eligible as per your region.

Step 5: Choose Instance Type - For free select only free tier eligible t2.micro and t3.micro as per your region, Click Next: Configure Instance Details.

Step 6: Configure Instance - Don't Change anything if you are beginner, for developer configuration can be done like Number of instances, VPC Network, Need an spot instance, File system, Monitoring, Shutdown behaviour etc. , Click Next: Add Storage

Step 7: Add Storage - Don't Change anything if you are beginner, Specify the how much in GB of storage you need for your machine and also the type either type of  SSD or Magnetic and Need Encryption on Storage ( EBS Volume )

Step 8: Add Tags - This step is option related to differentating multiple instances and its volumes ( storages ) of same type, mean giving your personal name to identify instance and its storage.

Step 9: Security Group ( Firewall Security ) - This service is important, it control how your instance or machine can be accessed. It is very crucial to setup for web servers. Defaulty only SSH port is open so that you can access you machine. You can change source either all can access or your computer IP ( MY IP ) can be used. After setting the IP your instance will be accessible from specified IP Address. Now Click on Review and Launch

Step 10: Review - In this view, you can check what configuration you have specified for your instance. Do check it carefully if you are just starting with AWS. After this Click Launch, and setup key pair for your instance

Step 11: Create a new key pair or choose existing. This key is reuired as a password for accessing your instance or machine. Download Key pair and keep it safe. If it lost somehow your are not be able to access your instance again.

Step 12: Click on Launch Instances your instance will now start launching. Click on View instnace to view all instances you have. 

Step 13: Click on Security Group, and select your named security group ( launch-wizard-1 ) edit inbound rules for HTTP and HTTPS as per your requirements.

Step 14: Only For web server, allocate Elastic IP address to your instance, Elastic IP means the static IP address that you not change whether you stop or again start your instance. Don't Keep Elastic IP without attached to running instance otherwise it will cost to more than usual.

Step 15: Once Elastic IP is allocate, select the IP and click on action and click associate IP address. Select instance ID of instance on which you want this IP to be fixed. Now Click on associate

For Accessing your instance from Linux or MAC

Step 1: Open terminal, Give only read permission to pem file. 

 command:  sudo chmod 400 ubuntu.pem

Step 2: Type command for ssh access

 command:  ssh -i ubuntu.pem 

ubuntu.pem is a key pair you downloaded while launching your instance.

Step 3: When you successfully log on to your instance, update packages repositories

 command:  sudo apt-get update

Step 4: Download XAMPP 

 command:  wget https://www.apachefriends.org/xampp-files/8.0.9/xampp-linux-x64-8.0.9-0-installer.run

Step 5: Make Execute Installation

 command:  sudo chmod +x xampp-linux-x64-8.9.0-0-installer.run

Step 6: Run Installation

 command:   sudo ./xampp-linux-x64-8.9.0-0-installer.run

Step 7: 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

Step 8: Run XAMPP

 command:  sudo /opt/lampp/lampp start

Step 9: XAMPP Configurations

Step 10: Restart XAMPP

 command:  sudo /opt/lampp/lampp restart

Step 11: XAMPP Security Settings

 command:  sudo /opt/lampp/xampp security

Step 12: PhpMyadmin - Access at https://IP_Address/phpmyadmin

Step 13: Copy your project folder from /home/ubuntu to /opt/lampp/htdocs directory

Step 14: In /opt/lampp/htdocs create .htaccess file to configure domain redirection 

  • Share On: