apache虚拟主机配置一例_Linux

复制代码 代码如下:

fivetrees extra # cat httpd-vhosts.conf_bak
#
# 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 doesn't 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
#NameVirtualHost *:443
#
# 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 192.168.1.66>
#        RewriteEngine On
#        RewriteMap      lowercase       int:tolower
#        RewriteMap      vhost   txt:/usr/local/apache/conf/host.txt
#        RewriteCond     %{HTTP_HOST}    !^$
#        RewriteCond     ${lowercase:%{HTTP_HOST}|NONE}  ^(.+)$
#        RewriteRule     ^/(.*...)$ ${vhost:%1...}/$1
#</VirtualHost>
<VirtualHost *:80>
        DocumentRoot /opt/all_dir
        ServerName *
</VirtualHost>
<VirtualHost *:80>
        DocumentRoot /opt/1
        ServerName 1.com
</VirtualHost>
<VirtualHost *:80>
        DocumentRoot /opt/2
        ServerName 2.com
</VirtualHost>

#<VirtualHost *:443>
#        DocumentRoot /home/hello
#        ServerName hello.baidu.com
#</VirtualHost>

时间: 2024-09-20 17:44:21

apache虚拟主机配置一例_Linux的相关文章

apache 虚拟主机配置多IP配置方法

apache 虚拟主机配置多IP配置方法 开启虚拟主机配置文件 对httpd.conf进行设置: 1.注释以下三行 #ServerAdmin #ServerName #DocumentRoot 2.去掉mod_proxy.so和mod_proxy_ajp.so的注释 3.#Virtual hosts #Include conf/extra/httpd-vhosts.conf (查找这行,把前面的#去掉) /conf/extra/httpd-vhosts.conf 4.打开 /conf/extra

最新版apache虚拟主机配置与应用学习教程

要配置apache的虚拟主机,我们需要分以下几步进行: 1. 检查apache虚拟主机模块 2. 开启apache虚拟主机功能 3. httpd-vhosts.conf文件详解 4. 根据IP配置虚拟主机 5. 根据端口配置虚拟主机 6. 根据域名配置虚拟主机 一.检查apache虚拟主机模块 apache要配置虚拟主机,就需要先查看apache是否编译vhost_alias_module模块.当然apache默认是已经编译该模块的,我们可以通过以下命令查看是否已经编译模块,如下: /usr/l

域名-apache虚拟主机配置无效,直接跳回根目录的原因是什么?

问题描述 apache虚拟主机配置无效,直接跳回根目录的原因是什么? 使用的是apache2.4.9,将httpd-vhost文件里的模板复制一份更改后发现, 域名访问全部跳回网站根目录,这是什么原因? 解决方案 Include "conf/extra/httpd-vhosts.conf" 解决方案二: Apache 虚拟主机 VirtualHost 配置

apache虚拟主机配置: 二级目录访问跳转到其他根文件夹_Linux

访问 http://www.abc.com/course/ ,实际访问的是:d:/www/moodle/index.PHP <VirtualHost *:80> ServerAdmin webmaster@abc.com DocumentRoot "d:/www/abc" ServerName www.abc.com ##ServerAlias Alias /course "d:/www/moodle" <Directory "d:/ww

apache中伪静态配置和使用(Apache虚拟主机下Discuz伪静态)_Linux

一 打开 Apache 的配置文件 httpd.conf . 二 将#LoadModule rewrite_module modules/mod_rewrite前面的#去掉 三 在 httpd.conf中添加: <IfModule mod_rewrite.c> RewriteEngine On #RewriteCond %{ENV:SCRIPT_URL} (?:index|dispbbs)[-0-9]+\.html RewriteRule ^(.*?(?:index|dispbbs))-([-

如何配置apache虚拟主机的实例小结_Linux

1.基于ip地址的虚拟主机 复制代码 代码如下: Listen 80<VirtualHost 172.20.30.40>    DocumentRoot /home/httpd/html1    ServerName www.ok1.com    ErrorLog /usr/local/apache/logs/error1_log    CustomLog /usr/local/apache/logs/access1_log combined</VirtualHost><Vi

apache虚拟主机配置-php在配置apache虚拟主机时启动虚拟主机配置后就无法启动apache

问题描述 php在配置apache虚拟主机时启动虚拟主机配置后就无法启动apache 在httpd.conf 配置虚拟主机: Virtual hosts ,虚拟主机 Include conf/extra/httpd-vhosts.conf 将上一句Include这句话打开后,apache就无法启动了,而且其他的配置都检查了,没有问题. 查看了error.log (部分log)是这样的: Starting the Apache2.2 service The Apache2.2 service is

apache 虚拟主机配置 泛域名配置方法

<VirtualHost *:80> ServerName www.111cn.net JkMountFile conf/uriworkermap.properties </VirtualHost> <VirtualHost *:80> ServerName mail.abc.com ServerAlias *.111cn.net  111cn.net*.abc.com.cn abc.com.cn RewriteEngine On         RewriteRule

Linux系统下Apache虚拟主机配置的步骤

说明: Apache版本:httpd-2.2.31 Apache安装目录:/usr/local/apache 目的: 配置Apache虚拟主机 具体操作: 1.修改Apache主配置文件 cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf-bak #修改之前先备份 vi /usr/local/apache/conf/httpd.conf #修改 找到# Virtual hosts这一行,添加以下两行: In