Apache服务器虚拟主机(vhost)常见配置
本文涵盖了Apache服务器中常用的vhost配置方法,由于时间关系不在文中进行讲解,仅供参考。
#
# 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 doesnt 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 dgdenterprise@gmail.com
DocumentRoot "C:/WANMP/apps/web1.vtest.org"
ServerName web1.vtest.org
# ServerAlias web1.vtest.org
Directory "C:/WANMP/apps/web1.vtest.org"
Options Indexes
Order allow,deny
IndexOptions Name Charset=UTF-8
Allow from all
/Directory
ErrorLog "logs/web1.vtest.org-error.log"
CustomLog "logs/web1.vtest.org-access.log" common
/VirtualHost
VirtualHost *:80
ServerAdmin dgdenterprise@gmail.com
DocumentRoot "C:/WANMP/apps/web2.vtest.org"
ServerName web2.vtest.org
ErrorLog "logs/web2.vtest.org-error.log"
CustomLog "logs/web2.vtest.org-access.log" common
/VirtualHost
VirtualHost *:80
ServerAdmin dgdenterprise@gmail.com
DocumentRoot "C:/WANMP/apps/bbs.vtest.org"
ServerName bbs.vtest.org
ErrorLog "logs/bbs.vtest.org-error.log"
CustomLog "logs/bbs.vtest.org-access.log" common
Directory C:\WANMP\apps\bbs.vtest.org/
Options FollowSymLinks
AllowOverride All
# Order deny,allow
# Deny from all
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic topic=$1 %1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view aid=$1 page=$2 %1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay fid=$1 page=$2 %1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread tid=$1 extra=page\%3D$3 page=$2 %1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group fid=$1 page=$2 %1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space $1=$2 %1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space uid=$1 do=blog id=$2 %1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1 value=$2 %1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$12 %1
/Directory
/VirtualHost
VirtualHost *:80
ServerAdmin dgdenterprise@gmail.com
DocumentRoot "C:/WANMP/apps/sns.vtest.org"
ServerName sns.vtest.org
ErrorLog "logs/sns.vtest.org-error.log"
CustomLog "logs/sns.vtest.org-access.log" common
/VirtualHost
VirtualHost *:80
ServerAdmin dgdenterprise@gmail.com
DocumentRoot "C:/WANMP/apps/www.vtest.org"
ServerName www.vtest.org
ErrorLog "logs/www.vtest.org-error.log"
CustomLog "logs/www.vtest.org-access.log" common
/VirtualHost
VirtualHost *:80
ServerAdmin dgdenterprise@gmail.com
DocumentRoot "C:/WANMP/apps/sql.vtest.org"
ServerName sql.vtest.org
ErrorLog "logs/sql.vtest.org-error.log"
CustomLog "logs/sql.vtest.org-access.log" common
/VirtualHost
VirtualHost *:80
ServerAdmin dgdenterprise@gmail.com
DocumentRoot "C:/WANMP/apps/dns.vtest.org"
ServerName dns.vtest.org
ErrorLog "logs/dns.vtest.org-error.log"
CustomLog "logs/dns.vtest.org-access.log" common
/VirtualHost
VirtualHost *:80
ServerAdmin dgdenterprise@gmail.com
DocumentRoot "C:/WANMP/apps/php.vtest.org"
ServerName php.vtest.org
ErrorLog "logs/php.vtest.org-error.log"
CustomLog "logs/php.vtest.org-access.log" common
/VirtualHost
VirtualHost *:80
ServerAdmin dgdenterprise@gmail.com
DocumentRoot "C:/WANMP/apps/tmp.vtest.org"
ServerName file.vtest.org
ErrorLog "logs/file.vtest.org-error.log"
CustomLog "logs/file.vtest.org-access.log" common
Directory "C:/WANMP/apps/tmp.vtest.org"
Options Indexes
Order allow,deny
IndexOptions Name Charset=UTF-8
Allow from all
/Directory
/VirtualHost
VirtualHost *:80
ServerAdmin dgdenterprise@gmail.com
ServerName proxy.vtest.org
ProxyPass / http://172.16.169.52/
ProxyPassReverse / http://172.16.169.52/
ErrorLog "logs/proxy.vtest.org-error.log"
CustomLog "logs/proxy.vtest.org-access.log" common
/VirtualHost
VirtualHost *:80
ServerAdmin dgdenterprise@gmail.com
ServerName main.deploy.elp
DocumentRoot "C:/WANMP/apps/main.vtest.org"
# LogFormat "%h %l %u %t \"%r\" % s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" % s %b" vhostcommon
CustomLog logs/main.deploy.elp-access.log vhostcommon
ErrorLog "logs/main.deploy.elp-error.log"
/VirtualHost
本文出自 “通信,我的最爱” 博客,请务必保留此出处http://dgd2010.blog.51cto.com/1539422/1394105
Apache 单IP配置多个HTTPS虚拟主机 Apache 文档中提到,不能在单个 IP上同时有多个按名字识别的虚拟主机( named virtual host ),其实不完全是这样了。 使用SNI SNI全称Server Name Indication(服务器名称指示),这个问题可以解决apache中的单IP多HTTPS虚拟主机,只有默认第一个站点的SSL生效的问题。但是这些技术需要浏览器的版本支持
相关文章
- Apache配置与应用
- Apache 配置与应用
- Apache配置详解(最好的APACHE配置教程)
- Apache Web服务器安全配置全攻略[通俗易懂]
- apache 负载均衡 超时设置_apache负载均衡配置
- linux搭建apache_plsql安装教程及配置
- apache的安装与配置_apache2.4安装教程
- 基于 Apache Hudi 构建分析型数据湖
- Apache、Nginx和Tomcat之虚拟主机配置
- apache用Linux服务器架设QQ五笔输入法服务:基于Apache技术(qq五笔linux)
- 服务Linux下重启Apache服务的步骤(linux重启apache)
- 如何使用 Apache Web 服务器配置多个站点
- 如何正确卸载Linux服务器上的Apache Web服务器?(linux卸载apache)
- 如何在Apache中配置MySQL数据库连接(mysql、apache)
- Win9x/ME下Apache+PHP安装配置
- Apache服务器配置攻略1
- Win2003下APACHE+PHP5+MYSQL4+PHPMYADMIN的简易安装配置
- 《PHP边学边教》(02.Apache+PHP环境配置——下篇)
- windows2003下apache配置虚拟主机和绑定域名服务
- Apache配置详解(最好的APACHE配置教程)
- Apache多端口多站点配置方法
- 正确配置与维护Apache安全性设置方法
- apache和php之间协同工作的配置经验分享
- 解析centos中Apache、php、mysql默认安装路径
- 解析阿里云ubuntu12.04环境下配置Apache+PHP+PHPmyadmin+MYsql
- apache下运行cgi模式的配置方法