一个域名指向一个项目;多个域名指向同一个项目
2015-12-15 21:44
225 查看
一、一个域名或IP指向一个项目,如dm.fengdi.com.cn:
1.在本地创建两个项目,如Test1,Test2(两个文件中均有一个index.php文件)
2.在apache/config/httpd.conf文件中解开
Include conf/extra/httpd-vhosts.conf
3.在apache/config/httpd.conf文件中
listen 81
listen 82
4.在apache/apache/conf/extra/httpd-vhosts.conf文件中输入
NameVirtualHost *:81
<VirtualHost *:81>
DocumentRoot "D:/wamp/www/Test1"
ServerName Test1.com
<Directory "D:/wamp/www/Test1">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
NameVirtualHost *:82
<VirtualHost *:82>
DocumentRoot "D:/wamp/www/Test2"
ServerName Test2.com
<Directory "D:/wamp/www/Test2">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
5.在C:/Windows/System32/drivers/etc/hosts文件最后添加两行
127.0.0.1 Test1.com
127.0.0.1 Test2.com
6.在windows的DOS环境下ping Test1.com查看域名的IP地址是否生效
7.重启Apache
8.在浏览器地址栏输入
localhost:81 或是 127.0.0.1:81 或是 Test1.com(指向Test1项目)
localhost:82 或是 127.0.0.1:82 或是 Test2.com((指向Test2项目)
二、多个域名指向同一个项目,如go.lp.fengdi.com.cn;go.zb.fengdi.com.cn等类似go.*.fengdi.com.cn
因为这个项目是在Linux系统下,时隔一年多,有些忘记了,这里就不介绍了,以免错误信息影响,以后有机会在Linux系统下做项目时再测试看看
1.在本地创建两个项目,如Test1,Test2(两个文件中均有一个index.php文件)
2.在apache/config/httpd.conf文件中解开
Include conf/extra/httpd-vhosts.conf
3.在apache/config/httpd.conf文件中
listen 81
listen 82
4.在apache/apache/conf/extra/httpd-vhosts.conf文件中输入
NameVirtualHost *:81
<VirtualHost *:81>
DocumentRoot "D:/wamp/www/Test1"
ServerName Test1.com
<Directory "D:/wamp/www/Test1">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
NameVirtualHost *:82
<VirtualHost *:82>
DocumentRoot "D:/wamp/www/Test2"
ServerName Test2.com
<Directory "D:/wamp/www/Test2">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
5.在C:/Windows/System32/drivers/etc/hosts文件最后添加两行
127.0.0.1 Test1.com
127.0.0.1 Test2.com
6.在windows的DOS环境下ping Test1.com查看域名的IP地址是否生效
7.重启Apache
8.在浏览器地址栏输入
localhost:81 或是 127.0.0.1:81 或是 Test1.com(指向Test1项目)
localhost:82 或是 127.0.0.1:82 或是 Test2.com((指向Test2项目)
二、多个域名指向同一个项目,如go.lp.fengdi.com.cn;go.zb.fengdi.com.cn等类似go.*.fengdi.com.cn
因为这个项目是在Linux系统下,时隔一年多,有些忘记了,这里就不介绍了,以免错误信息影响,以后有机会在Linux系统下做项目时再测试看看
相关文章推荐
- SetForegroundWindow的正确用法
- 《利用python进行数据分析》读书笔记--第九章 数据聚合与分组运算(二)
- Python-MySQL summary
- 关于python的编解码(decode, encode)
- android中的ViewTreeObserver
- 【Android 学习】之二维码扫描开发(闪光灯功能)
- ospf基本配置协议
- 【黑马程序员】第六章:Java API
- 豆瓣电影的爬虫示例
- HDU5599GTW likes tree
- KVO delegation与KVO的区别和优缺点
- ServerSAN解析(二):Nutanix实现存储与计算资源集成
- 调频,调幅与调相
- xshell配色方案
- css布局模型
- 如何将多个源文件编译为一个.ko
- 点击子对象,不解触发父对象click事件
- javascript(二):DOM
- Android开发之ListView-ArrayAdapter的使用
- Linux系统忘记密码