• 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>
  • 相关阅读:
    自动补全命令插件的安装(centos)
    vim tab设置为4个空格
    CentOS系统将UTC时间修改为CST时间
    Zabbix报错 zabbix:cannot convert value to numeric type解决
    php-fpm平滑重启开启关闭
    虚拟机启动network服务失败,Job for network.service failed because the control process exited with error code问题
    Tomcat中设置站点子目录的方法
    WordPress添加背景音乐plus教程
    WordPress使用必应每日一图作登录页面背景
    WordPress自定义美化
  • 原文地址:https://www.cnblogs.com/BTMaster/p/3567755.html
Copyright © 2020-2023  润新知