Configuration of Apache Virtual Host in Ubuntu

Source: Internet
Author: User

The configurations of virtual hosts in Ubuntu are somewhat different from those in windows.

To create a VM, follow these steps:

1. In the/etc/apache2/sites-available/directory, create a file for you to configure the host, open it, and configure it:

sudo vi /etc/apache2/sites-available/webQQ
# This is a webqq VM <virtualhost *: 80>
# The root directory of the VM, DocumentRoot/var/www/webqq
# Host name servername www.webqq.com
# Configure the root directory <directory/varwww/webqq>
# Directoryindex index.html options indexes followsymlinks </directory> </virtualhost>

2 ., because the Apache configuration file apache2.conf only uses the include command to include files in the/etc/apache2/Site-Enable/directory, the file does not contain files in the/etc/apache2/sites-available/directory, therefore, we soft-link the/etc/apache2/sites-available/webqq to the/etc/apache2/sites-Enable/directory, so that our VM is successfully configured, when we do not want this virtual host, we can delete the soft link under/etc/apache2/Site-Enable.

sudo ln -s /etc/apache2/sites-available/webQQ  /etc/apache2/sites-enable

3. We also need to add the ing between the host name and IP address in the/etc/hosts file.

127.0.0.1    www.webQQ.com

4. In the last step, restart Apache.

sudo /etc/init.d/apache2 restart

In this way, our VM is successfully configured.

  

Configuration of Apache Virtual Host in Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.