Marlon's Blog

记录生活、技术中的二三事.


  • Home

  • Archives

  • Tags

  • Bio

windows下的apache配置多站点

Published at: 2014-07-22   |   Reading: 363 words ~1min

apache下配置多个网站:

在apache的配置文件中找到httpd.conf里找到

#Include conf/extra/httpd-vhosts.conf

去掉前面的#注释

在conf\extra\httpd-vhosts.conf文件里配置如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#

# Virtual Hosts

#

# If you want to maintain multiple domains/hostnames on your

# machine you can setup VirtualHost containers for them. Most configurations

# use only name-based virtual hosts so the server doesn't need to worry about

# IP addresses. This is indicated by the asterisks in the directives below.

#

# Please see the documentation at

# <URL:http://httpd.apache.org/docs/2.2/vhosts/>

# for further details before you try to setup virtual hosts.

#

# You may use the command line option '-S' to verify your virtual host

# configuration.



#

# Use name-based virtual hosting.

#

NameVirtualHost *:80



#

# VirtualHost example:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for all requests that do not

# match a ServerName or ServerAlias in any <VirtualHost> block.

#

<VirtualHost *:80>

    ServerAdmin admin.chinablackhat.org

    DocumentRoot "e:/www"         (网站的位置)

    ServerName www.chinablackhat.org       (域名)

    ServerAlias www.chinablackhat.org

    ErrorLog "logs/dummy-host.x-error.log"

    CustomLog "logs/dummy-host.x-Access.log" common

</VirtualHost>



<VirtualHost *:80>

    ServerAdmin admin.chinablackhat.org

    DocumentRoot "e:/www/test"    (网站位置)

    ServerName test.chinablackhat.org      (网站域名)

    ErrorLog "logs/dummy-host2.x-error.log"

    CustomLog "logs/dummy-host2.x-Access.log" common

</VirtualHost>
#apache#
  • Author: Marlon Fan
  • Link: https://www.marlon.life/2014/07/22/windows%E4%B8%8B%E7%9A%84apache%E9%85%8D%E7%BD%AE%E5%A4%9A%E7%AB%99%E7%82%B9/
  • License: All articles in this blog are licensed under CC BY-NC-ND 4.0 unless stating additionally.
windows安装上mysql以后空密码的处理方法
git在sublime text中的使用
Marlon Fan

Marlon Fan

宁静致远

48 Blogs
30 Tags
Homepage GitHub Twitter Zhihu
Friends
    过往云烟
© 2008 - 2024 Marlon Fan. All rights reserved. 晋ICP备20002733号-1
0%