How To Create Virtual Host On Apache Web Server Using Ubuntu 14.046 min read
The Apache Soft is a powerful open source web server. The Apache web server already uses cpanel and many more server. Now is popular to think name based virtual host. It’s provide from Apache web server. So I configure step by step name based virtual host on your server.
★ How To Install Mysql Server on Ubuntu 14.04
★ How To Install mysql Community on Windows 10
Name based virtual host requirements: Ready one Ubuntu 14.04 machine
- Create one machine
- RAM : 1 GB
- Ethernet port : 1
- CPU : 2
Step :#01: You new machine update and upgrade command below:
root@Virtual-Machine:~# apt-get update && apt-get upgrade -y
After few minutes wait for upgrade then install Apache web server command
root@Virtual-Machine:~# apt-get install apache2 apache2-utils php5 libapache2-mod-php5 php5-mcrypt
Step #02: When installation complete then goto directory for setup virtual host.
root@Virtual-Machine:~# cd /etc/apache2/sites-available/
Step #03: Create or open tech1.conf file for site one. File create command touch tech1.conf
root@Virtual-Machine:/etc/apache2/sites-available# vi tech1.conf
Insert below all line into tech1.conf file.
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerAlias tech1 DocumentRoot /var/www/html/tech1/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Step #04: Create another tech2.conf file.
root@Virtual-Machine:/etc/apache2/sites-available# vi tech2.conf
Insert below all line into tech2.conf file.
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerAlias tech2 DocumentRoot /var/www/html/tech2/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Step #05: Enable tech1 site using a2ensite command.
root@Virtual-Machine:/etc/apache2/sites-available# a2ensite tech1.conf
Enabling site tech1.
To activate the new configuration, you need to run:
service apache2 reload
Reload apache server
root@Virtual-Machine:/etc/apache2/sites-available# service apache2 reload
Enable tech2 site using a2ensite command
root@Virtual-Machine:/etc/apache2/sites-available# a2ensite tech2.conf
Enabling site tech2.
To activate the new configuration, you need to run:
service apache2 reload
Now reload apache server
root@Virtual-Machine:/etc/apache2/sites-available# service apache2 reload
Step #06: Now goto created web directory /var/www/html/tech1 and then create new index.html or index.php file.
# touch index.html
# touch index.php
root@Virtual-Machine:/var/www/html/tech1# vi index.php
Insert below all lines into index.php file
<!DOCTYPE html> <html> <body> <h1>This is Tech1 site</h1> <p>This is Tech1 site.</p> </body> </html>
Step #07: Now goto created web directory /var/www/html/tech2 and then create new index.html or index.php file.
# touch index.html
# touch index.php
Insert below all lines into index.php file
<!DOCTYPE html> <html> <body> <h1>This is Tech2 site</h1> <p>This is Tech2 site.</p> </body> </html>
Final Step : Now test your created two sites. Goto browser and type your ip address and directory name like as below
http://10.66.10.11/tech1/
See example like as:
This is Tech1 site
This is Tech1 site.
http://10.66.10.11/tech2/
See example like as:
This is Tech1 site
This is Tech1 site.
If face any problem then see my YouTube video and Subscribe my channel. Please subscribe my channel for more update.
- How To Install Zabbix Server 6.4 On AlmaLinux 8 Server - August 9, 2024
- How To Clear RAM Memory Cache Buffer Linux Server - February 29, 2024
- How To Install Apache Cloud Stack Management Server 4.17 On Ubuntu 22.04 - February 1, 2024
We really appreciate for your support for buying me a coffee.
It takes us a while to compose and upload new content, as they have to be checked to see if Properly works. We appreciate you if you help me for one cup of coffee to keep us awake and always deliver good quality content.
No contribution is small of an amount. We are grateful for any amount you support us with. Thank you!