Configure virtual hosts in wampserver to support multiple sites

Source: Internet
Author: User

Wampserver is an integrated environment software developed by Germans to implement Apache + PHP + MySql in a Windows environment. wampserver comes with sqlitemanager and phpMyAdmin. It provides users with a simple and easy-to-use graphical interface, more than 10 language packs, including simplified Chinese and English, can be switched freely. wampserver can be used for fast configuration in the server environment or local testing. You can download it from the wampserver official website.

This articleArticleThis section describes how to configure the cnpeng.org test environment in the wampserver environment of the Local Machine. Similarly, you can configure virtual hosts on the server to achieve coexistence of multiple sites.

  1. Start the wampserver service. Click the wampserver icon in the lower right corner to open the "httpd. conf" file under the Apache menu;
  2. Add the following at the bottom of the "httpd. conf" file: Code :

     

    ## start to configure the VM. The domain name is cnpeng.org and the directory is D:/Wamp/www/cnpeng.org/
    namevirtualhost *: 80

    # serveradmin = administrator email
    serveradmin [url = mailto: admin@localhost.com] admin@localhost.com [/url]
    # DocumentRoot = drive path of the home directory of the website
    DocumentRoot D: /Wamp/www/cnpeng.org
    # servername = the bound domain name portal
    # That is: access requests through cnpeng.org
    servername cnpeng.org
    # Here is the access permission for configuring the website's main directory. Note the slash

    options followsymlinks
    AllowOverride none
    order allow, deny
    allow from all

    # Redefine the wampserver root directory
    Namevirtualhost *: 80
    <Virtualhost *: 80>
    # Serveradmin = administrator email
    Serveradmin [url = mailto: admin@localhost.com] admin@localhost.com [/url]
    # DocumentRoot = the drive letter path of the home directory of the website
    DocumentRoot D:/Wamp/WWW
    # Servername = bound domain name Portal
    # That is, access requests through cnpeng.org
    Servername 127.0.0.1
    # Configure the access permission for the home directory of the website. Note the slash
    <Directory "D:/Wamp/www/">
    Options followsymlinks
    AllowOverride none
    Order allow, deny
    Allow from all
    </Directory>
    </Virtualhost>

  3. Click wampserver in the tray to restart all services;
  4. Use NotePad to open the hosts file in the C:/Windows/system32/Drivers/etc/directory and add a line at the bottom:

    127.0.0.1 cnpeng.org

OK! Enter the http://cnpeng.org in the browser, you can see that through HTTP has been accessed to the local D:/Wamp/www/cnpeng.org/directory.

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.