apache的多个站点配置
来源:互联网 发布:进出口海关数据 编辑:程序博客网 时间:2024/05/01 06:01
一、通过端口来区分不同的站点:
1、先开发好自己的网站:web1
a、配置httpd.conf文件,启用httpd-vhosts.conf
b、配置httpd-vhosts.conf
c、在hosts文件中添加ip和域名的对应关系
127.0.0.1 localhost
127.0.0.1 wood_funiture1.com
127.0.0.1 wood_funiture2.com
d、建议注销“DocumentRoot”
#DocumentRoot “C:/Documents/wood_funiture”
e、测试
2、添加一个新的域名与该IP进行绑定
A、开发一个新的网站:web2
B、配置httpd-vhosts.conf,添加新的虚拟主机
<VirtualHost *:81> ServerAdmin 245875166@qq.com DocumentRoot "C:/Documents/wood_funiture" ServerName wood_funiture.com ServerAlias www.wood_funiture.com ErrorLog "logs/dummy-wood_funiture.com-error.log" CustomLog "logs/dummy-wood_funiture.com-access.log" common <Directory "C:/Documents/wood_funiture"> RewriteEngine on # 如果请求的是真实存在的文件或目录,直接访问 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # 如果请求的不是真实文件或目录,分发请求至 index.php RewriteRule . index.php </Directory> <Directory "C:/Documents/wood_funiture"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Directory></VirtualHost>
<VirtualHost *:81> ServerAdmin 245875166@qq.com DocumentRoot "C:/Documents/wood_funiture" ServerName wood_funiture.com ServerAlias www.wood_funiture.com ErrorLog "logs/dummy-wood_funiture.com-error.log" CustomLog "logs/dummy-wood_funiture.com-access.log" common <Directory "C:/Documents/wood_funiture"> RewriteEngine on # 如果请求的是真实存在的文件或目录,直接访问 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # 如果请求的不是真实文件或目录,分发请求至 index.php RewriteRule . index.php </Directory> <Directory "C:/Documents/wood_funiture"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Directory></VirtualHost>
二、通过ServerName端区分开不同的域名
1、开发新的站点
2、在httpd-vhosts.con文件中添加配置
<VirtualHost *:80> ServerAdmin 245875166@qq.com DocumentRoot "C:/Documents/wood_funiture" ServerName wood_funiture1.com ServerAlias www.wood_funiture.com ErrorLog "logs/dummy-wood_funiture.com-error.log" CustomLog "logs/dummy-wood_funiture.com-access.log" common <Directory "C:/Documents/wood_funiture"> RewriteEngine on # 如果请求的是真实存在的文件或目录,直接访问 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # 如果请求的不是真实文件或目录,分发请求至 index.php RewriteRule . index.php </Directory> <Directory "C:/Documents/wood_funiture"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Directory></VirtualHost>
<VirtualHost *:80> ServerAdmin 245875166@qq.com DocumentRoot "C:/Documents/wood_funiture" ServerName wood_funiture2.com ServerAlias www.wood_funiture.com ErrorLog "logs/dummy-wood_funiture.com-error.log" CustomLog "logs/dummy-wood_funiture.com-access.log" common <Directory "C:/Documents/wood_funiture"> RewriteEngine on # 如果请求的是真实存在的文件或目录,直接访问 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # 如果请求的不是真实文件或目录,分发请求至 index.php RewriteRule . index.php </Directory> <Directory "C:/Documents/wood_funiture"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Directory></VirtualHost>
0 0
- 【小结】Apache 多个站点的配置
- apache的多个站点配置
- apache配置多个站点
- apache配置多个站点的几种常用方法
- APACHE配置多个站点 -多站点配置
- [转]apache配置多个站点
- Apache配置多个站点(非虚拟目录)
- apache入门基本知识,配置多个站点
- Freebsd apache配置多个端口站点
- Apache下配置多个站点
- windows apache 配置多个服务站点
- window下apache配置多个站点
- windows apache 配置多个服务站点
- windows apache 配置多个服务站点
- windows下apache配置多个站点
- apache 2.4 配置多个站点
- Apache 本地配置多个虚拟站点
- Apache 的多站点配置
- Nodejs在ubuntu中安装
- Red5流媒体服务器开发总结
- 编码问题
- POJ1821-Fence
- (0)Java学习笔记之绪论 --- 学什么
- apache的多个站点配置
- java源码学习2-Integer
- **浙大PAT甲级 1105
- 同桌的你
- Swift学习:2.2 基本运算符
- ubuntu 下的限速软件 wondershaper 以及 命令行测试网速
- android 获取SD卡里的所有TXT文件
- 在onResume和onPause之间做功能的一些思考
- php 实现HTML实体编号与非ASCII字符串相互转换类