Wampserver environment, Apache Local set up multiple domain names

Source: Internet
Author: User

Apache after the installation by default just point to a site, that is, 127.0.0.1, if you want to make multi-site configuration, you need to change some configuration.

Steps, Methods:

1) allows Apache to load the virtual host module at boot time.

Open the Apache installation directory under the conf/httpd.conf file, find the following two lines of text, the first # number is removed, and then saved.

#LoadModule Vhost_alias_module modules/mod_vhost_alias.so
#LoadModule Rewrite_module modules/mod_rewrite.so
#Include conf/extra/httpd-vhosts.conf

2,) The next step is to find the DocumentRoot and directory nodes in httpd.conf if our site is set up in:

EXAMPLE001 Site Address: "d:/wamp/www/example001"

EXAMPLE002 Site Address: "d:/wamp/www/example002"

Then modify the configuration as follows:


#
# each directory to which Apache have access can is configured with respect
# to which services and features is allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<directory/>
Options FollowSymLinks
#AllowOverride None
# Modify @2015-09-19
AllowOverride All
Order Deny,allow
Deny from all
</Directory>

#
# forward must specifically allow
# particular features to being enabled-so if something ' s not working as
# You are might expect, make sure so you have specifically enabled it
# below.
#

#
# This should is changed to whatever your set DocumentRoot to.
#
<directory "d:/wamp/www/" >
#
# Possible values for the Options directive is "None", "all",
# or any combination of:
# Indexes includes followsymlinks symlinksifownermatch execcgi multiviews
#
# Note that "MultiViews" must is named *explicitly*---"Options all"
# doesn ' t give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride Controls What directives is placed in. htaccess files.
# It can be ' all ', ' None ', or any combination of the keywords:
# Options FileInfo authconfig Limit
#
AllowOverride All

#
# Controls who can get stuff from the this server.
#

# onlineoffline Tag-don ' t remove
Order Deny,allow
Deny from all
#Allow from 127.0.0.1
# Modify @2015-09-19
Allow from all
</Directory>

3,) After completing the above configuration save, locate the path conf/extra/httpd-vhosts.conf to configure:

Note:

<virtualhost *:8080>

#ServerAdmin是站点管理员邮箱
ServerAdmin [email protected]

#DocumentRoot is the site root directory
DocumentRoot "C:/apache2/docs/dummy-host.example.com"

#ServerName is the site URL
ServerName dummy-host.example.com

#ServerName is the site URL extension
Serveralias www.dummy-host.example.com

#ErrorLog is the site error log storage path
Errorlog "Logs/dummy-host.example.com-error.log"

#CustomLog is the site Client access log storage path
Customlog "Logs/dummy-host.example.com-access.log" common
</VirtualHost>

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine your can setup VirtualHost containers for them. Most configurations
# Use of name-based virtual hosts so the server doesn ' t need to worry about
# IP addresses. This was indicated by the asterisks in the directives below.
#
# documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before your try to setup virtual hosts.
#
# The command line option '-s ' to verify your virtual host
# configuration.

#
# use name-based virtual hosting.
#
Namevirtualhost *:8080

#
# VirtualHost Example:
# Almost any Apache directive could go into a VirtualHost container.
# The first VirtualHost section was used for all requests and that does not
# match a ServerName or Serveralias in any <VirtualHost> block.
#
#<virtualhost *:8080>
# ServerAdmin [Email protected]_blog.com
# documentroot "D:\wamp\www\thinkphp_blog"
# ServerName Www.thinkphp_blog.com
# Serveralias Www.thinkphp_blog.com
# errorlog "Logs/thinkphp_blog.com-error.log"
# customlog "Logs/thinkphp_blog.com-access.log" common
#</virtualhost>
<virtualhost *:8080>
#管理员邮箱
ServerAdmin [email protected]
#根目录
DocumentRoot "D:/wamp/www/blog"
#默认域名
ServerName tblog001.com
#用 * indicates a generic domain name, if you want to receive three-level pan-domain name resolution, you can write this: *.my.cnmiss.cn
Serveralias *.tblog001.com
#错误日志
Errorlog Logs/tblog001-error.log
#用户日志
Customlog "Logs/tblog001-access.log" common
#下面为目录权限配置信息, you can omit
<directory "D:/wamp/www/blog" >
Options Indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
</VirtualHost>

4,) Configure the host (the last line of the C:\Windows\System32\drivers\etc\host file to enter, add the following line), save.

127.0.0.1 www.tblog001.com

5,) Restart Wampserver, enter the URL (http://www.tblog001.com:8080/) to access:

Wampserver environment, Apache Local set up multiple domain names

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.