Apache 根据不同的端口 映射不同的站点
以前,在本地新建个项目,总是在Apache的htdocs目录下新建个项目目录,今年弄了个别人写好的网站源码,因为该系统的作者假定网站是放在根目录的,放在二级目录下会出错。所以无奈,只能想办法,根据端口映射到一个新的站点。
在网上查了下资料,以下是我的修改过程:
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
首先,在Apache的配置文件httpd.conf中,找到上面的两条语句,将第二行前面的注释符‘#’去掉,改成:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
然后,打开conf\extra文件夹,打开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>
Apache 根据不同的端口 映射不同的站点的更多相关文章
- Apache服务器中设置端口映射和反向代理的方法
在/etc/httpd/conf路径下的httpd.conf文件###new add for webui.cong###Include "E:/local/Wamp/bin/apache/A ...
- CentOS下Apache配置多域名或者多端口映射
CentOS下Apache默认网站根目录为/var/www/html,假如我默认存了一个CI项目在html文件夹里,同时服务器的外网IP为ExampleIp,因为使用的是MVC框架,Apache需开启 ...
- Apache添加多端口及实现单ip多端口映射的方法
这篇文章主要介绍了Apache添加多端口及实现单ip多端口映射的方法的相关资料,需要的朋友可以参考下(http://www.0831jl.com) 先给大家说下apache添加多端口的方法,具体步骤如 ...
- 用端口映射在Apache中对每个项目分配端口,实现一个端口访问一个网站
映口映射的功能主要就是实际互联网可以访问当前进行映射的电脑,首先我们要进行路由器的端口映射,常见的开放端口有80,21,3389等,80是网站常用端口,21是FTP服务器常用端口,3389是远程桌面连 ...
- 局域网虚拟机端口映射访问apache
如果我们在虚拟机内搭建好服务器后,希望可以在局域网内的设备上都能访问到这个虚拟服务器,就可以参照以下步骤来操作.其中包括了很多遇到的坑.先说说我的环境是 宿主机:windows 8.1 虚拟机:vmw ...
- 使用 Anydesk 5.1 TCP 通道(端口映射)功能从外网方便访问内网的 web/数据库等资源
Anydesk 5.1 带来一个新的功能:TCP 通道,在家办公时,通过互联网进行远程桌面连接到公司电脑,可以将家用电脑的某个端口,映射到公司网络的某个电脑( IP + 端口),不局限于被远程桌面连接 ...
- Windows10环境配置nat123端口映射访问mysql
背景:因工作需要,在宽带路由器内部设置一个台式机(可上网),配置成数据库服务器.分散各处的多台外网机可以通过jdbc连接该数据库服务器进行开发.要进行端口映射. 环境: 宽带通 Windows10企业 ...
- Tp-link TL-WR841N无线路由器端口映射到外网如何设置
针对TP-LINK的无线路由器进行演示如何设置端口映射和访问控制,演示使用的具体型号是TP-LINK TL-WR841N 3G无线路由器如何设置端口映射. 什么是端口映射? 端口映射又称端口转发,有的 ...
- TTradmin v1.1 - 免端口映射穿透任何内网、基于radmin核心的即时远程协助
TTradmin 是一款免端口映射可直接穿透任何内网,基于radmin核心的即时远程协助软件.在使用的时候只需要保证“协助端”和“被协助端”使用同一个验证码即可实现安全便捷的远程控制,不需要进 ...
随机推荐
- When you want to give up, remember why you started.
When you want to give up, remember why you started.当你想要放弃的时候,请记住当初你为何而开始.
- 织梦ckeditor编辑器 通过修改js去除img标签内的width和height样式
1. 文件\include\ckeditor\plugins\image\dialogs\image.js 2. 使用工具美化js代码 3. 搜索 setStyle('width', CKEDITOR ...
- js当前日期
function CurentTime() { var now = new Date(); var year = now.getFullYear(); ...
- 洛谷 P1079 Vigenère 密码
题目描述 16 世纪法国外交家 Blaise de Vigenère 设计了一种多表密码加密算法――Vigenère 密 码.Vigenère 密码的加密解密算法简单易用,且破译难度比较高,曾在美国南 ...
- self & this 上下文
对象:指向对象的首地址: 函数:代表了函数运行的主要上下文: 内部:在类的内部使用. self Within the body of a class method, self refers to th ...
- spring maven 包
<spring-framework.version>.RELEASE</spring-framework.version> <dependency> <gro ...
- kubernetes-平台日志收集(ELK)
使用ELK Stack收集Kubernetes平台中日志与可视化 K8S系统的组件日志 K8S Cluster里面部署的应用程序日志 日志系统: ELK安装 安装jdk [root@localhost ...
- DROP RULE - 删除一个重写规则
SYNOPSIS DROP RULE name ON relation [ CASCADE | RESTRICT ] DESCRIPTION 描述 DROP RULE 删除一个规则. PARAMETE ...
- nodejs安装遇到npm命令无法使用问题
解决方法: 在用户文件夹中建立npm文件夹就可以使用了. 再使用npm命令就可以了.
- Mybatis学习记录(3)
1.输出映射和输入映射 Mapper.xml映射文件定义了操作数据库的sql,每个sql就是一个statement,映射文件是mybatis的核心. (1)parameterType(输入类型) ...