多站点配置实例
来源:互联网 发布:哥伦比亚冲锋衣 知乎 编辑:程序博客网 时间:2024/06/05 14:11
(一)虚拟目录的配置
方法一: /conf/extra/httpd-vhosts.conf
① vi httpd.conf:
更改成
ServerName 219.13.34.32:80
然后在文件中添加以下内容:
② vi httpd-vhosts.conf:
NameVirtualHost 219.13.34.32
<VirtualHost 219.13.34.32>
ServerAdmin afd@dsf.com
DocumentRoot /usr/local/apache/htdocs
ServerName 219.13.34.32
</VirtualHost>
#
<VirtualHost 219.13.34.32>
ServerAdmin dsf@af.com
DocumentRoot /usr/local/apache/htdocs/upload
ServerName desk.xker.com
</VirtualHost>
#
<VirtualHost 219.13.34.32>
ServerAdmin adf@fda.com
DocumentRoot /usr/local/apache/htdocs/upload2
ServerName tool.xker.com
</VirtualHost>
其中:NameVirtualHost 219.13.34.32很重要,没有这个,虚拟主机是不可以建立成功的。
方法二: /conf/vhosts/ *.conf
① vi /conf/extra/httpd-vhosts.conf
NameVirtualHost *:80
Include /alidata/server/httpd/conf/vhosts/*.conf (引入/vhosts下的所有配置文件)
② vi /conf/vhosts/*.conf 每个站点建一个配置文件
<DirectoryMatch "/alidata/www/www.zodigrand.com/(attachment|html|data)">
<Files ~ ".php">
Order allow,deny
Deny from all
</Files>
</DirectoryMatch>
<VirtualHost *:80>
DocumentRoot /alidata/www/www.zodigrand.com
ServerName www.zodigrand.com
ServerAlias zodigrand.com
<Directory "/alidata/www/www.zodigrand.com">
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)-htm-(.*)$ .php?
RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ /simple/index.php?
</IfModule>
ErrorLog "/alidata/log/httpd/www.zodigrand.com-error.log"
CustomLog "/alidata/log/httpd/www.zodigrand.com.log" common
</VirtualHost>
(二)开启Apache加载扩展文件
注:httpd-vhosts.conf 文件是扩展文件,Apache是默认不加载的,需要告诉Apache去包含这个文件
打开httpd.conf文件:
搜索httpd-vhost,找到 Include conf/extra/httpd-vhosts.conf(表示包含扩展文件httpd-vhosts)。把注释去掉
(三)开启 允许外部主机访问服务器
注:因为Apache默认是拒绝其它外部主机地址访问服务器下的资源,所以还要修改允许其它地址访问
打开httpd.conf文件:
搜索根目录名,然后往下滚动,找到
2.2上的配置
Order deny,allow
Deny from all
2.4上的配置
Require all denied
################################################
2.2上的配置
Order deny,allow
Allow from all
2.4上的配置
Require all granted
(四)在本地添加域名解析
打开C:\\Windows/System32/drivers/etc/hosts文件
在里面 添加需要增加的站点
- 多站点配置实例
- Ubuntu下Apache2多站点配置实例讲解
- apache配置新的站点实例
- tomcat多站点配置
- TOMCAT多站点配置
- Apache 多站点配置
- Apache多站点配置
- Apache多站点配置
- TOMCAT多站点配置 .
- Apache配置多站点
- Tomcat 多站点配置
- apache 多站点配置
- nginx多站点配置
- Apache多站点配置
- wamp多站点配置
- Apache多站点配置 .
- tomcat 多站点配置
- Apache多站点配置
- 【html5和css3】网页导航基础
- 配置文件上传大小限制
- HDOJ 1032 The 3n+1 problem
- logcat
- Hibernate之关于HQL语句参数的绑定
- 多站点配置实例
- 51nod--1256 乘法逆元 (扩展欧几里得)
- Sizeof与Strlen的区别与联系
- php 工厂方法模式
- win7下创建.htaccess文件的几种方法
- 开发错误手册
- showModalDialog功能笔记
- 锋利的jQuery 学习笔记-第一章 认识JQuery
- IOS中的多线程