Apache服务器中配置虚拟机的方法
新浪微博虚拟机开发配置步骤及介绍。
1、由于后面虚拟机中需要用到Rewrite所以先编辑Apache的conf目录下的httpd.conf文件。(可根据实际需要操作)
添加mod_rewrite.so模块支持。去掉下列行中前面的#号。
LoadModule rewrite_module modules/mod_rewrite.so
2、配置apache支持虚拟机。这一步很重要。
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
找到 上面相关文本,去掉#Include conf/extra/httpd-vhosts.conf前的#。
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
保存退出。
3、编辑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.
#
<VirtualHost *:80>
#管理员邮箱
ServerAdmin jiangfeng3@staff.sina.com.cn
#项目根目录
DocumentRoot "D:/htdocs/frame_export"
#域名
ServerName test.t.sina.com.cn
#别名
ServerAlias test.t.sina.com.cn
#错误日志路径
ErrorLog "logs/test.t.sins.com.cn-error.log"
CustomLog "logs/test.t.sins.com.cn-access.log" common
RewriteEngine on
#重写规则,可根据实际需要添加
RewriteRule ^/(.*)$ /apps/index.php [L]
</VirtualHost>
4、编辑本地host文件,以windows为例
进入C:/Windows/System32/drivers/etc
记事本打开hosts文件
最后添加
127.0.0.1 localhost
127.0.0.1 test.t.sina.com.cn
例子:
# 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 test.t.sina.com.cn
保存退出
5、重启apache,浏览器输入http://test.t.sina.com.cn
转载请注明原文地址:http://www.server110.com/apache/201309/1615.html
Apache服务器中配置虚拟机的方法的更多相关文章
- Nginx服务器中配置非80端口的端口转发方法详解
这篇文章主要介绍了Nginx服务器中配置非80端口的端口转发方法详解,文中使用到了Nginx中的proxy_pass配置项,需要的朋友可以参考下 nginx可以很方便的配置成反向代理服务器: 1 2 ...
- 【转】Apache服务器安全配置
源URL:http://foreversong.cn/archives/789 偶然下载了今年ISC大会360应急响应中心的一个ppt,在最后有个攻防领域专家注册考试目录,其中有很大一块就是中间件的安 ...
- 分享:linux下apache服务器的配置和管理
linux下apache服务器的配置和管理. 一.两个重要目录: Apache有两个重要的目录:1.配置目录/etc/httpd/conf:2.文档目录/var/www: 二.两种配置模式: Apac ...
- delphi7开发webservice部属在apache服务器中 转
delphi7开发webservice部属在apache服务器中 delphi7 webservice apache 用Delphi7开发Web Service程序,并把服务程序放在apache We ...
- django项目部署在Apache服务器中,静态文件路径的注意点
django Apache部署静态文件的路径注意点 静态文件放在对应的 app 下的 static 文件夹中 或者 STATICFILES_DIRS 中的文件夹中. 当 DEBUG = True 时, ...
- Windows操作系统Apache服务器下配置PHP
在Apache web服务器上发布PHP项目之前,需要进行相应的配置,服务器才能解析php文本,正常显示php动态页面内容.在进行php配置之前默认已经在Windows系统下安装好了Apache服务器 ...
- Windows下Apache服务器中自动配置二级子域名
今天我们介绍的这个办法,只需要简单修改 httpd-vhosts.conf 文件,配合 .htaccess 文件即可实现自动配置二级域名. 我们这里以 wpchina.com 为例,以下代码中的 wp ...
- Apache服务器中运行CGI程序的方法,文中以Perl脚本作为示例
关于apache与CGI在这里就不解释了. 1.apache下面以2.0.63为例介绍运行CGI程序的配置.(http://www.nklsyy.com) 2.下载Windows下的Perl解释器Ac ...
- iOS学习系列-Apache服务器的配置
配置Apache服务器 一.目的 能够有一个测试的服务器,不是所有的特殊网络服务都能找到免费得! 二.为什么我们要用"Apache"? Apache是目前使用最广的web服务器 M ...
随机推荐
- crontab读取环境变量方法
crontab如果不注意的话早晚会出问题,而且这种问题一旦出一次,就会永远记得,因为这种问题很折腾人. ...
- POJ3126 Prime Path
http://poj.org/problem?id=3126 题目大意:给两个数四位数m, n, m的位数各个位改变一位0 —— 9使得改变后的数为素数, 问经过多少次变化使其等于n 如: 10331 ...
- 13个Cat命令管理文件实例汇总
在Linux系统中,大多数配置文件.日志文件,甚至shell脚本都使用文本文件格式,因此,Linux系统存在着多种文本编辑器,但当你仅仅想要查看一下这些文件的内容时,可使用一个简单的命令-cat. c ...
- 求一列的和,awk和perl哪个快?
下午和群里的朋友争论了一下,有关awk和perl处理文本的速度,自己一直比较推崇perl,对awk知之甚少,结果就想当然的觉得perl快,结果一番争吵后,觉得还是实验一下靠谱,(其实是想证明一下per ...
- MemCacheManager
#region Fields private AreaRepository _areaRepository = new AreaRepository(); private ICacheManager ...
- python视频教程大全
python3英文视频教程(全87集) http://pan.baidu.com/s/1dDnGBvV python从入门到精通视频(全60集)链接:http://pan.baidu.com/s/1e ...
- heritrix
Heritrix3.0教程 http://blog.csdn.net/neo_liukun/article/category/1118819
- iOS开发——高级UI&带你玩转UITableView
带你玩装UITableView 在实际iOS开发中UITableView是使用最多,也是最重要的一个控件,如果你不会用它,那别说什么大神了,菜鸟都不如. 其实关于UItableView事非常简单的,实 ...
- 利用nf_conntrack机制存储路由,省去每包路由查找
IP是无连接的,因此IP路由是每包一路由的,数据包通过查找路由表获取路由,这是现代操作协议协议栈IP路由的默认处理方式.可是假设协议栈具有流识别能力,是不是能够基于流来路由呢?答案无疑是肯定的. 设计 ...
- JS加解密URL参数encodeURIComponent() decodeURIComponent()
参考1:http://www.w3school.com.cn/js/jsref_encodeURIComponent.asp 参考2:http://www.w3school.com.cn/js/jsr ...