add .htaccess in your directory
.htaccess code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
welcome
welcome
If you don't have an AWS account yet, you'll need to create one:
Visit AWS and click "Create an AWS Account."
Follow the instructions to set up your account, including entering payment information.
2. Launch an EC2 Instance
Once your AWS account is set up, follow these steps to launch an EC2 instance:
Log into AWS Console:
Go to the AWS Management Console and log in.
Navigate to EC2 Dashboard:
On the AWS services dashboard, type EC2 in the search bar and select it.
Launch an Instance:
In the EC2 dashboard, click the Launch Instance button.
Enter a name for your instance.
Choose an Amazon Machine Image (AMI):
Select Ubuntu Server (version 20.04 or 22.04 LTS is recommended). Ensure the AMI is Free Tier eligible if you are using the free tier.
Choose Instance Type:
For the free tier, select the t2.micro instance type.
Click Next.
Configure Instance Details:
Leave all default settings unless you need to customize the networking, IAM role, or additional configurations.
Add Storage:
The default 8 GB size is usually fine, but you can increase it if needed (within Free Tier limits).
Add Tags:
(Optional) Add tags to identify and manage your instance easily.
Configure Security Group:
Set up a security group to control traffic:
SSH: Type: SSH, Port: 22, Source: My IP (recommended).
HTTP (optional, if setting up a web server): Type: HTTP, Port: 80, Source: Anywhere (0.0.0.0/0).
Review and Launch:
Click Review and Launch.
Ensure the settings are correct and click Launch.
Select/Create a Key Pair:
Select Create a new key pair.
Give the key pair a name and click Download Key Pair. This will download a .pem file, which is essential for SSH access.
Click Launch Instances.
3. Connect to Your EC2 Instance
Now that your instance is running, you need to connect to it:
Open a terminal on your local machine (or use an SSH client like PuTTY on Windows).
Change Permissions for the Key File:
Ensure your .pem key has the correct permissions:
chmod 400 your-key.pem
Connect to the EC2 Instance via SSH:
Replace your-key.pem with your key pair file and ec2-user@your-ec2-public-ip with the public IP of your EC2 instance.
ssh -i your-key.pem ubuntu@your-ec2-public-ip
4. Update Your Ubuntu Server
Once connected, update the Ubuntu instance with the following commands:
sudo apt update
sudo apt upgrade -y
5. Install Apache (Optional for a Web Server)
If you want to set up a web server, you can install Apache:
sudo apt install apache2 -y
Enable Apache to start on boot:
sudo systemctl enable apache2
To check if Apache is running:
sudo systemctl status apache2
You can access your web server by visiting your EC2 instance’s public IP in your browser: http://your-ec2-public-ip.
6. Install PHP (Optional for a PHP Server)
To run PHP on your server:
sudo apt install php libapache2-mod-php -y
You can verify PHP installation:
php -v
7. Install MySQL (Optional for a Database Server)
To install MySQL, use:
sudo apt install mysql-server -y
Secure MySQL installation:
sudo mysql_secure_installation
8. Configure Firewall (Optional)
You can configure ufw to allow SSH, HTTP, and HTTPS:
sudo ufw allow OpenSSH
sudo ufw allow 'Apache Full'
sudo ufw enable
9. Accessing Your Web Server
If you've set up Apache, you can access it by typing your EC2 instance’s public IP address in a browser:
http://your-ec2-public-ip
You should see the Apache default page.
10. Transfer Files to EC2 (Optional)
To transfer files from your local machine to the EC2 server, use scp or an FTP client like WinSCP:
Example using scp to upload a file to /var/www/html:
scp -i your-key.pem localfile.txt ubuntu@your-ec2-public-ip:/var/www/html
Yt india YouTube channel is a fake channel.
After payment they will not responding please be careful