• Apache 根据不同的端口 映射不同的站点


      以前,在本地新建个项目,总是在Apache的htdocs目录下新建个项目目录,今年弄了个别人写好的网站源码,因为该系统的作者假定网站是放在根目录的,放在二级目录下会出错。所以无奈,只能想办法,根据端口映射到一个新的站点。

      在网上查了下资料,以下是我的修改过程:

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

      首先,在Apache的配置文件httpd.conf中,找到上面的两条语句,将第二行前面的注释符‘#’去掉,改成:

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

      然后,打开confextra文件夹,打开httpd-vhosts.conf文件,这个是一个模板文件,稍做修改即可,以下是我改后的文件内容:

    #
    # 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.
    #
    Listen 8090 <VirtualHost *:
    8090> ServerAdmin webmaster@dummy-host.localhost DocumentRoot "D:/Program Files/Apache Software Foundation/Apache2.2/htdocs/wanjinv3" ServerName localhost:8090 # ServerAlias www.dummy-host.localhost ErrorLog "logs/dummy-host.localhost-error.log" CustomLog "logs/dummy-host.localhost-access.log" common <Directory "D:/Program Files/Apache Software Foundation/Apache2.2/htdocs/wanjinv3"> # # 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.2/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: # Options FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # Order allow,deny Allow from all </Directory> </VirtualHost>
  • 相关阅读:
    js监听对象属性的改变
    js中的垃圾回收机制
    防抖和节流
    Ajax的浏览器缓存问题及解决方法
    Java多线程系列---“基础篇”07之 线程休眠
    Java多线程系列---“基础篇”06之 线程让步
    Java多线程系列---“基础篇”05之 线程等待与唤醒
    Java多线程系列---“基础篇”04之 synchronized关键字
    Java多线程系列---“基础篇”03之 Thread中start()和run()的区别
    Java多线程系列---“基础篇”02之 常用的实现多线程的两种方式
  • 原文地址:https://www.cnblogs.com/BTMaster/p/3567755.html
Copyright © 2020-2023  润新知