windows apache服务器配置多域名
来源:互联网 发布:淘宝客新建导购推广 编辑:程序博客网 时间:2024/05/18 10:11
本文通过配置apache服务器,实现student.com,teacher.com两个程序的配置,演示windows下 apache多域名配置。
PS:以下将apache安装目录简称为安装目录。
1、配置httpd.conf
打开安装目录下conf/httpd.conf 文件,找到
# Virtual hosts# Include conf/extra/httpd-vhosts.conf
将Include conf/extra/httpd-vhosts.conf 前面#号去掉
2、配置httpd-vhosts.conf
打开安装目录下conf/extra/httpd-vhost.conf,删掉原内容。
添加如下代码:
<VirtualHost *:80> ServerAdmin admin@student.com DocumentRoot "D:/ProgramTools/projects/student" ServerName student.com ServerAlias www.student.com ErrorLog "logs/student.com-error.log" CustomLog "logs/student.com-access.log" common <directory "D:/ProgramTools/projects/student"> Options FollowSymLinks AllowOverride all Order Deny,Allow Deny from all Allow from all </directory></VirtualHost>
以上是配置student.com 程序,teacher.com配置类似它。
student.com 程序目录在D:/ProgramTools/projects/student.
参考上述,在httpd-vhost.conf中配置teacher.com
3、添加host
在windows下需要在浏览器中通过student.com 访问本地的student web application 需要添加host。
打开C:\Windows\System32\drivers\etc\hosts 文件,添加如下代码:
127.0.0.1 student.com127.0.0.1 www.student.com127.0.0.1 teacher.com127.0.0.1 www.teacher.com
4、准备student.com 和 teacher.com程序
这里每一个程序都仅仅只有一个index.php文件。内容分别输出 hello student ! 和 hello teacher!
5、重启apache服务器并浏览器输入student.com和teacher.com测试。
PS:配置完毕vhost后会导致默认的www目录不能访问了。如果需要访问。可以参考student程序的方法,配置一个localhost即可。
<VirtualHost *:80> ServerAdmin 1849406240@qq.com DocumentRoot "D:/ProgramTools/wamp/www" ServerName localhost.com ServerAlias www.localhost.com ErrorLog "logs/localhost.com-error.log" CustomLog "logs/localhost.com-access.log" common <directory "D:/ProgramTools/wamp/www"> Options FollowSymLinks AllowOverride all Order Deny,Allow Deny from all Allow from all </directory></VirtualHost>
0 0
- windows apache服务器配置多域名
- 本地apache服务器配置多域名
- 本地apache服务器配置多域名
- Windows系统下如何配置虚拟域名 Apache服务器
- 本地apache服务器配置域名
- Apache配置多域名
- Apache配置多域名
- apache配置多域名
- apache多域名配置
- apache多域名配置
- Apache windows 配置一个 IP 绑定多个域名
- linux下Apache服务器配置虚拟域名
- Apache服务器简单配置虚拟域名
- ubuntu apache 多域名配置
- apache下配置多域名。
- 配置https服务器系列之三:windows服务器配置letsencrypt证书,多子域名配置
- nginx服务器多域名配置
- 服务器的多域名配置
- poj 1458 最长公共子序列
- Android总结篇系列:Activity Intent Flags及Task相关属性
- Vim 粘贴板
- linux 信号 回收子进程
- 6.1、贝叶斯分类器
- windows apache服务器配置多域名
- hdoj 3336 Count the string 【KMP】
- 简单验证码的有关知识点
- Objective-C简介
- 最简洁的nginx反向代理例子配置
- Word Search II 题解
- 快速排序中分区算法的延伸——划分多个区间
- 可变长参数示例
- C++自制Redis 数据库(九) 详细数据库存储结构,线程相关已解决