How Apache builds a virtual host

Source: Internet
Author: User

Apache Build Virtual Host method

DocumentRoot:/home/fdipzone/sites/demo.fdipzone.com

ServerName:demo.fdipzone.com

1. Enter Apache virtual host Setup Directory

Cd/etc/apache2/sites-available

2. Create File demo.fdipzone.com

<virtualhost *:80>  
        ServerAdmin webmaster@localhost  
      
        documentroot/home/fdipzone/sites/ demo.fdipzone.com  
        ServerName demo.fdipzone.com  
        serveralias demo.fdipzone.com <directory  
        "/home/ Fdipzone/sites/demo.fdipzone.com ">  
                allow from all Options + Indexes  
        </Directory>  
</ Virtualhost>

3. Activate the virtual host configuration

sudo a2ensite demo.fdipzone.com

Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/web/

4. Enter the/etc/apache2/sites-enabled/directory to view all active virtual hosts. You can log off with sudo a2dissite demo.fdipzone.com

cd/etc/apache2/sites-enabled  
ls-lt  
displays  
lrwxrwxrwx 1 root 2013-04-05 17:29 demo.fdipzone.com. /sites-available/demo.fdipzone.com

5. Restart Apache Service

Sudo/etc/init.d/apache2 restart

6.ubuntu Setting Host

Vim/etc/hosts  
127.0.0.1 demo.fdipzone.com

7.<directory> settings Open. htaccess and display directory structure list

<directory "/home/fdipzone/demo.fdipzone.com" >  
allowoverride none  
allowoverride all  
Options- Index followsymlinks  
</Directory>

AllowOverride none indicates closing. htaccess, if you want to turn on the can set to allowoverride all

Options-indexes indicates that the directory structure is turned off to display if you want to turn on options Indexes

The Options followsymlinks indicates support for symbol link (soft connection), if you want to turn it off to be set to Options-followsymlinks

Related Article

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.