HTML
Point Your Domain and Host HTML Files
2 min read
#HTMLPoint 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
-
Login to Your Domain Provider Website
-
Navigate to Manage DNS
-
Add the Following Records:
Type Host/Name Value A @ Your Remote Server IP A www Your Remote Server IP AAAA @ Your Remote Server IPv6 AAAA www Your Remote Server IPv6
2. Upload Your Project Files
-
On Your Local Windows Machine:
- Make your project folder a ZIP file using software like WinZip.
-
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
- Syntax:
-
Verify Successful Copy:
- Access the remote server via SSH:
- Syntax:
ssh -p PORT USERNAME@HOSTIP
- Example:
ssh -p 22 root@216.32.44.12
- Syntax:
- Access the remote server via SSH:
3. Setup and Verify Your Web Server
-
Go to the Destination Path Where You Copied the ZIP File:
- Syntax:
cd Destination_Path
- Example:
cd /var/www
- Syntax:
-
Verify ZIP File Presence:
- Command:
ls
- Command:
-
Unzip the Copied ZIP File:
- Syntax:
unzip zip_file_name
- Example:
unzip osmsProject.zip
- Syntax:
-
Verify Required Software:
- Apache2 Version:
apache2 -v
- MySQL:
mysql
- PHP Version:
php -v
- Apache2 Version:
-
Verify Apache2 is Active and Running:
- Command:
service apache2 status
- Command:
-
Verify Web Server Ports are Open:
- Command:
ufw status verbose
- Command:
4. Configure Apache Virtual Host
-
Create Virtual Host File:
- Command:
nano /etc/apache2/sites-available/your_domain.conf
- Command:
-
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>
-
Enable Virtual Host:
- Command:
a2ensite your_domain.conf
- Command:
-
Disable Default Virtual Host (Optional):
- Command:
a2dissite 000-default.conf
- Command:
-
Restart Apache2:
- Command:
service apache2 restart
- Command: