Apache domain name-based Virtual Host Configuration

Source: Internet
Author: User

In Apache domain name-based virtual host configuration, multiple methods can achieve the same purpose. In the configuration process, record the configuration that is considered simple and clear by one person, so as not to forget.

1. When multiple sites are built on a Linux host, a default site is required. In the httpd. conf file, modify and add:

<Virtualhost _ default _: 80>
DocumentRoot/var/www/html
</Virtualhost>
Do not enable the default site.

2. Remove # Before # namevirtualhost *: 80 to enable the VM function.

3. You can add a VM as follows and configure it as required:

<Virtualhost *: 80>
Serveradmin webmaster @ .example.com
DocumentRoot/var/www/ns/
Servername ns.example.com
Errorlog logs/ns.example.com-error_log
Customlog logs/ns.example.com-access_log common
</Virtualhost>
<Virtualhost *: 80>
Serveradmin webmaster@abc.com
DocumentRoot/var/www/phpMyAdmin
Servername www.abc.com
Errorlog logs/www.abc.com-error_log
Customlog logs/www.abc.com-access_log common
</Virtualhost>

Certificate -----------------------------------------------------------------------------------------------------------------------------------------------------------------------

In the c: \ windows \ system32 \ drivers \ etc \ hosts table
127.0.0.1 localhost
127.0.0.1 fading.cn
127.0.0.1 dz6.fading.cn
127.0.0.1 x.fading.cn
Or modify the DNS. Multiple Domain Names direct to the same IP address.
Access path:
Http://fading.cn or localhost
Http://dz6.fading.cn
Http://x.fading.cn

Alias alias:

Alias/dz6/"D:/HTTP/wwwroot/discuz! _ 6.0.0 _ SC _gbk/upload /"
<Directory "D:/HTTP/wwwroot/discuz! _ 6.0.0 _ SC _gbk/upload ">
Options indexes Multiviews
AllowOverride none
Order allow, deny
Allow from all
</Directory>

Alias/X/"D:/HTTP/wwwroot/xspace/upload /"
<Directory "D:/HTTP/wwwroot/xspace/upload">
Options indexes Multiviews
AllowOverride none
Order allow, deny
Allow from all
</Directory>
Must be used for access
Http: // localhost/X/Add/
Http: // localhost/dz6/Add/

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.