gou-tian / gou-tian.github.io

个人博客站点
http://blog.goutian.win
4 stars 3 forks source link

Apache 虚拟主机配置 #5

Open gou-tian opened 7 years ago

gou-tian commented 7 years ago

Apache 虚拟主机配置

标签: Apache 虚拟主机 虚拟主机配置


httpd.vhosts.conf文件配置

虚拟主机配置

  • 默认虚拟目录
    <VirtualHost *:80>
    # This first-listed virtual host is also the default for *:80
    ServerName localhost
    DocumentRoot "G:\wamp\www"
    </VirtualHost>
  • 虚拟主机配置
    <VirtualHost *:80>
    # This first-listed virtual host is also the default for *:80
    ServerName 2017.gt
    DocumentRoot "G:\wamp\www\2017"
    </VirtualHost>
    <VirtualHost *:80>
    DocumentRoot "G:\GitHub\xxx.github.io"
    ServerName b.gt
    </VirtualHost>

    httpd.conf

    
    /* 查找地点大概在240行左右 或是搜索 Directory */
    <Directory />
    AllowOverride all
    Require all granted
    </Directory>
    #
    # Note that from this point forward you must specifically allow
    # particular features to be enabled - so if something's not working as
    # you might expect, make sure that you have specifically enabled it
    # below.
    #
    <Directory "G:/wamp/www/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be 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.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride all
    #
    # Controls who can get stuff from this server.
    #

    # onlineoffline tag - don't remove
    Require all granted
</Directory>
## windowns 7 HOST文件配置
# Copyright (c) 1993-2009 Microsoft Corp.
## This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
## This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one# space.
## Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
## For example:
##      102.54.94.97     rhino.acme.com          
# source server
#       38.25.63.10     x.acme.com              
# x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1       localhost# ::1             localhost

127.0.0.1       localhost
127.0.0.1       b.gt
127.0.0.1       2017.gt