Pages

Monday, April 15, 2024

Host you own web project in that server


1. **Connect via SSH**: Use the `ssh` command to connect to your instance directly, assuming you've already set up your SSH key and know your EC2 instance's public IP address:

   ssh -i your_key.pem ubuntu@your_ec2_public_ip

   If prompted to confirm the connection, type `yes`.

2. **Install Apache**: Install Apache web server and update packages:

   sudo apt update

   sudo apt install apache2

3. **Switch to Root User**: Switch to the root user to gain administrative privileges:

   sudo su

4. **Navigate to Web Root**: Move to the directory where you want to host your web files (usually `/var/www/html`):

   cd /var/www/html

5. **Edit HTML File**: Use a text editor like Nano or Vim to edit your HTML file:

   nano index.html

6. **Restart Apache**: After making changes, restart Apache for the changes to take effect:

    systemctl restart apache2

7.Now, your web project should be hosted on your EC2 instance. You can access it through your EC2's public IP address.

 

No comments:

Post a Comment

If you have any doubt ,please comment here