Saturday, September 14, 2024

How to Set Up XAMPP Server on an Ubuntu AWS EC2 Instance: A Complete Guide

 If you’re looking to host web applications on AWS EC2 and need a powerful, flexible local server environment, XAMPP is an excellent choice. In this guide, I’ll walk you through the process of setting up a XAMPP server on an Ubuntu instance hosted on AWS EC2. Whether you’re a beginner or have some experience with cloud services, this step-by-step tutorial will help you get your XAMPP server up and running in no time!

For a visual walkthrough of the concepts covered in this article, check out my YouTube Video:-

Step 1: Launch Your EC2 Instance on AWS

  1. Choose the AMI (Amazon Machine Image): Select Ubuntu as your operating system. I recommend using the latest version of Ubuntu for the best compatibility.
  2. Instance Type: For most users, a t2.micro instance works well, especially if you’re on the free tier.
  3. Configure Instance: Set up the network settings, such as VPC and subnet. You can use the default configurations if you’re unsure.
  4. Add Storage: The default 8GB of storage should be sufficient, but you can increase this if your application needs more space.
  5. Configure Security Group: Make sure to open the HTTP, HTTPS, and SSH ports so you can access your server from a web browser and securely connect to it via SSH.
  6. Launch and Connect: Once your instance is running, connect to it using SSH from your local machine.

Step 2: Install XAMPP on Your Ubuntu EC2 Instance

Now that your EC2 instance is up and running, the next step is to install XAMPP.

  1. Download XAMPP:
wget https://www.apachefriends.org/xampp-files/x.x.x/xampp-linux-x64-x.x.x-installer.run

2. Make the Installer Executable:

sudo chmod +x xampp-linux-x64-x.x.x-installer.run

3. Run the Installer:

sudo ./xampp-linux-x64-x.x.x-installer.run

Follow the on-screen instructions to complete the installation process.

Step 3: Start XAMPP

Once XAMPP is installed, start the services (Apache, MySQL, and ProFTPD) by running the following command:

sudo /opt/lampp/lampp start

To verify that XAMPP is running, open your browser and enter your EC2 instance’s public IP address followed by /xampp. If the installation was successful, you should see the XAMPP dashboard.

Step 4: Configuring Your Server for Web Access

By default, XAMPP is accessible only from localhost. To make it accessible from the web, you’ll need to modify the configuration file.

  1. Edit the httpd.conf File:
sudo nano /opt/lampp/etc/httpd.conf

2. Update the Security Configuration: Look for the line that restricts access and update it to allow access from any IP address:

Require all granted

3.Restart XAMPP:

sudo /opt/lampp/lampp restart

Step 5: Manage Security Settings

Ensure your EC2 instance’s security group allows inbound traffic on ports 80 (HTTP) and 443 (HTTPS) so external users can access your website. Additionally, consider configuring SSL for a more secure setup, especially if you plan to handle sensitive data.

Final Thoughts

Congratulations! You’ve successfully set up a XAMPP server on an Ubuntu AWS EC2 instance. With this setup, you’re now ready to deploy and test web applications on a flexible cloud platform. AWS provides a scalable environment, and XAMPP offers the familiar functionality of Apache, MySQL, PHP, and Perl.

Connect with Me:

No comments:

Post a Comment

Ethical Hacking Techniques: Cracking WPA/WPA2 Wi-Fi Using WPS and Capturing Handshakes

In the realm of cyber security, ethical hacking plays a crucial role in identifying and addressing vulnerabilities. One of the areas where e...