Shubham S Nimje logo
Shubham Nimje
HTML

Point Your Domain and Host HTML Files

Point Your Domain and Host HTML Files
2 min read
#HTML

Point Your Domain and Host HTML Files

Empower your website to reach the world! This comprehensive guide walks you through the steps of pointing your domain name to your remote server/VPS and hosting your HTML website files.

Prerequisites

  • A registered domain name.
  • A remote server/VPS with an Apache web server, PHP (optional), and SSH access.
  • Basic understanding of command line usage and file management.
  • Access to your domain provider’s control panel.

Instructions

1. Configure Your Domain

  1. Login to Your Domain Provider Website

  2. Navigate to Manage DNS

  3. Add the Following Records:

    TypeHost/NameValue
    A@Your Remote Server IP
    AwwwYour Remote Server IP
    AAAA@Your Remote Server IPv6
    AAAAwwwYour Remote Server IPv6

2. Upload Your Project Files

  1. On Your Local Windows Machine:

    • Make your project folder a ZIP file using software like WinZip.
  2. Open Command Prompt and Copy ZIP File:

    • Syntax: scp -P Port_number Source_File_Path Destination_Path
    • Example: scp -P 22 osmsProject.zip root@216.32.44.12:/var/www
  3. Verify Successful Copy:

    • Access the remote server via SSH:
      • Syntax: ssh -p PORT USERNAME@HOSTIP
      • Example: ssh -p 22 root@216.32.44.12

3. Setup and Verify Your Web Server

  1. Go to the Destination Path Where You Copied the ZIP File:

    • Syntax: cd Destination_Path
    • Example: cd /var/www
  2. Verify ZIP File Presence:

    • Command: ls
  3. Unzip the Copied ZIP File:

    • Syntax: unzip zip_file_name
    • Example: unzip osmsProject.zip
  4. Verify Required Software:

    • Apache2 Version: apache2 -v
    • MySQL: mysql
    • PHP Version: php -v
  5. Verify Apache2 is Active and Running:

    • Command: service apache2 status
  6. Verify Web Server Ports are Open:

    • Command: ufw status verbose

4. Configure Apache Virtual Host

  1. Create Virtual Host File:

    • Command: nano /etc/apache2/sites-available/your_domain.conf
  2. Add the Following Code:

    <VirtualHost *:80>
        ServerName www.example.com
        ServerAdmin contact@example.com
        DocumentRoot /var/www/project_folder_name
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
  3. Enable Virtual Host:

    • Command: a2ensite your_domain.conf
  4. Disable Default Virtual Host (Optional):

    • Command: a2dissite 000-default.conf
  5. Restart Apache2:

    • Command: service apache2 restart