Apache Virtual Host

Source: Internet
Author: User

Basic overview

Virtual Web Host
Run multiple Web sites on the same server, each of which does not occupy a single real computer
HTTPD supported virtual host types

    • Domain-based virtual host
    • IP address-based virtual host
    • Port-based virtual host
Modify the Master profile for the httpd service

Enables Apache services to load a standalone configuration file

Vim/usr/local/httpd/conf/httpd.conf
1 # Virtual hosts 2 Include conf/extra/httpd-vhosts.conf    // Remove Annotations
Domain-based web hosting
Vim/usr/local/httpd/conf/extra/httpd-vhosts.conf #修改独立的配置文件
1Namevirtualhost192.168.10.1: the2 3<directory'/www'>//control access to the entire virtual host directory4 Order Allow,deny5  allow from all6</Directory>7 8<virtualhost192.168.10.1>//First Web site9DocumentRoot"/www/spdir"        //Site root directoryTenServerName www.spdir.com//the full domain name of the website OneErrorlog"Logs/www.spdir.com-error_log"        //error log storage location ACustomlog"Logs/www.spdir.com-access_log"Common//Access log storage location -</VirtualHost> -  the<virtualhost192.168.10.1>//a second website -DocumentRoot"/www/tt80" - ServerName www.tt80.com -Errorlog"Logs/www.tt80.com-error_log" +Customlog"Logs/www.tt80.com-access_log"Common -</VirtualHost> +  A  atThird website ...
httpd-vhosts.conf File Contents
Service httpd Restart #重新启动httpd
Port-based Web virtual host
Vim/usr/local/httpd/conf/extra/httpd-vhosts.conf #修改独立的配置文件
1Namevirtualhost192.168.10.12 3<directory'/www'>//control access to the entire virtual host directory4 Order Allow,deny5  allow from all6</Directory>7 8<virtualhost192.168.10.1: the>//First Web site9DocumentRoot"/www/spdir"        //Site root directoryTenServerName www.spdir.com//the full domain name of the website OneErrorlog"Logs/www.spdir.com-error_log"        //error log storage location ACustomlog"Logs/www.spdir.com-access_log"Common//Access log storage location -</VirtualHost> -  the<virtualhost192.168.10.1:8080>//a second website -DocumentRoot"/www/tt80" - ServerName www.tt80.com -Errorlog"Logs/www.tt80.com-error_log" +Customlog"Logs/www.tt80.com-access_log"Common -</VirtualHost>
httpd-vhosts.conf File Contents
Service httpd Restart #重新启动httpd

Apache Virtual Host

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.