Apache Virtualhost – Multiple Websites on the same server

0
26



Would you like to learn how to install Apache and configure multiple Websites on a computer running Ubuntu Linux? In this tutorial, we are going to show you how to use the Virtualhost feature to configure multiple Websites on the same Apache server.

• Ubuntu 18
• Ubuntu 19
• Ubuntu 20
• Apache 2.4.41

In our example, the IP address of the Apache server is 36.160.86.106.

In our example, we are going to create the website: WWW.GAMEKING.TIPS.

Hardware List:

The following section presents the list of equipment used to create this tutorial.

Every piece of hardware listed above can be found at Amazon website.



Apache – Related Tutorial:

On this page, we offer quick access to a list of tutorials related to Apache.




Apache Virtualhost – DNS configuration

Access the GODADDY website and purchase a DNS domain.

In our example, we purchased a domain named:

Copy to Clipboard

You can use any website to purchase a DNS domain, GoDaddy is just my personal choice.

Create a DNS entry pointing your website to the computer running Apache.

In our example, we created a DNS entry pointing WWW.GAMEKING.TIPS to 35.160.86.106.

APACHE VIRTUALHOST DNS

Use the NSLOOKUP command to test your DNS configuration.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Congratulations! You have finished the required DNS configuration.



Tutorial Apache – Virtualhost configuration

Install the Apache server.

Copy to Clipboard

Enable Apache module named: Mod_rewrite.

Copy to Clipboard

Edit the Apache configuration file.

Copy to Clipboard

Add the following lines at the end of this file.

Copy to Clipboard

Create directories to store the new website files and logs.

Copy to Clipboard

The website files will be stored inside the following directory:

Copy to Clipboard

The website logs will be stored inside the following directory:

Copy to Clipboard

Create an Apache configuration file for the new website.

Copy to Clipboard

Here is the file with our configuration.

Copy to Clipboard

Enable the new website.

Copy to Clipboard

Restart the Apache service.

Copy to Clipboard

Open your browser and try to access the HTTP version of the website.

In our example, the following URL was entered in the Browser:

• http://www.gameking.tips

Apache - Lets encrypt

You have finished the virtual host configuration on the Apache server.



The post Apache Virtualhost – Multiple Websites on the same server appeared first on TechExpert.

Sumber: TechExpert

LEAVE A REPLY

Please enter your comment!
Please enter your name here