Skip to content

Jirage/Registration_Form_Deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Registration Form Deployment using MySQL on AWS EC2 with LEMP Stack

This project demonstrates the deployment of a user registration form integrated with a MySQL database, hosted on an AWS EC2 instance using the LEMP Stack (Linux, Nginx, MySQL, and PHP).

Project Objectives

  • Design and develop a user registration form.

  • Integrate form data with a MySQL database.

  • Deploy the application on a cloud-based AWS EC2 instance.

Prerequisites

  • AWS account with EC2 access

  • Key pair for SSH

  • Basic knowledge of terminal commands and AWS

  • MySQL and PHP experience (preferred)

Project Setup & Deployment Steps

Step 1: Launch an AWS EC2 Instance

Go to AWS Management Console → Search for EC2.

  • Under Instances, click Launch Instance.

    Configure:

  • AMI: Amazon Linux 2 AMI (Free Tier eligible)

  • Instance type: t2.micro

  • Key pair: Create/use existing one

  • Security group: Allow ports 22 (SSH) and 80 (HTTP)

  • Click Launch Instance

Step 2: SSH into EC2 Instance

bash
  • ssh -i "your-key.pem" ec2-user@your-public-ec2-dns
  • Switch to superuser:
bash
  • sudo -i

Step 3: Setup LEMP Environment

  • Create lemp.sh Script
bash
  • vim lemp.sh

  • Paste the following code: Lemp.sh

  • Make the script executable:

bash
  • chmod +x lemp.sh
  • Run the script:
bash
  • ./lemp.sh

Check service status:

bash
  • systemctl status nginx mariadb php-fpm

Step 4: Create the HTML Signup Form

bash
  • vim /usr/share/nginx/html/signup.html

  • Paste the following code: Signup.html

  • Save and exit the file.

Step 5: Create the PHP Script to Handle Form Submission

bash
  • vim /usr/share/nginx/html/submit.php

  • Paste the following code: Submit.php

  • Save and exit the file.

Step 6: Setup the MySQL Database

Login to MySQL:
bash
  • mysql -u root -p

Set root password if not already:

sql

  • ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_root_password';
  • exit;

Create a new database and user:

sql

  • CREATE DATABASE signup;

sql

USE signup;

sql

CREATE TABLE user ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(20), email VARCHAR(100), website VARCHAR(255), comment VARCHAR(100), gender VARCHAR(10) );

sql

  • exit

Step 7: Configure PHP to Connect to MySQL

bash

sudo yum install php8.4-mysqlnd.x86_64

Step 8: Restart Services

bash
  • sudo systemctl restart nginx
  • sudo systemctl restart mariadb
  • sudo systemctl restart php-fpm

Final Output

Open in browser:

http://your-ec2-public-ip/signup.html

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published