码迷,mamicode.com
首页 > Web开发 > 详细

apache配置虚拟主机

时间:2017-01-14 12:32:19      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:管理员   apache   option   address   cto   tcp   ons   map   style   

1、apache 的配置文件 httpd.conf;找到  

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

把include前的#注释去掉;

2、找到 apache conf 配置文件下extra文件夹下的 httpd-vhosts.conf 配置文件   

# Virtual Hosts
#

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/mydocument/wamp/wamp64/www
    <Directory  "D:/mydocument/wamp/wamp64/www/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>


#配置的虚拟主机 myhome <VirtualHost *:80> ServerName myhome DocumentRoot D:/mydocument/sentCMS <Directory "D:/mydocument/sentCMS/"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require local </Directory> </VirtualHost> #

3、解析域名找到 C:\Windows\System32\drivers\etc下的 hosts 配置

# 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 bandicam.com
127.0.0.1 ssl.bandisoft.com

127.0.0.1       localhost
#配置的myhome
127.0.0.1 myhome

注意 修改hosts 文件需要以管理员的身份访问  可以这样解决  右击鼠标 找到属性  到安全 、点编辑、   组名用户名选users、users  权限  勾修改 写入 应用即可!

 

第一次 访问时 前边加上HTTP//myhome/index.php

 

apache配置虚拟主机

标签:管理员   apache   option   address   cto   tcp   ons   map   style   

原文地址:http://www.cnblogs.com/kevin2016/p/6285015.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!