Ubuntu under Apache Multi-site Virtual host Configuration

Source: Internet
Author: User
Tags html comment

① Installing the Apache server

$ sudo apt-get update

$ sudo apt-get install apache2


② Configuring a single IP multi-site

$ sudo vi/etc/apache2/sites-available/000-default.conf

#DocumentRoot/var/www/html comment out the line


$ cat/etc/apache2/sites-available/000-default.conf|grep-v "#"

<virtualhost *:80>


ServerAdmin [email protected]

ServerName www.tian.com

DocumentRoot "/var/www/tian.com"


Errorlog ${apache_log_dir}/error.log

Customlog ${apache_log_dir}/access.log combined


</VirtualHost>


<virtualhost *:8080>

ServerName www.baidu.org

DocumentRoot "/var/www/baidu.org"

Errorlog ${apache_log_dir}/error.log

Customlog ${apache_log_dir}/access.log combined

</VirtualHost>

Note 1: Here the * refers to 127.0.01

NOTE 2: Configure multi-IP multi-site to remove the above *, replace with the required IP


③ Adding a listening port

$ sudo vi/etc/apache2/ports.conf

Listen 80

Listen 8080


④ Modify the host file and add the following

$ sudo vi/etc/hosts

127.0.0.1 www.tian.com

127.0.0.1 www.baidu.org

NOTE 1: Simulation experiment, actually add DNS

NOTE 2: Multiple IP can be modified to the corresponding IP


⑤ Browser for verification


This article is from the Notepad blog, so be sure to keep this source http://wangzhijian.blog.51cto.com/6427016/1690495

Ubuntu under Apache Multi-site Virtual host Configuration

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.