zoukankan      html  css  js  c++  java
  • apache基础

    apache基于多域名的虚拟主机

    NameVirtualHost *:80
    <VirtualHost *:80>
    DocumentRoot "/var/www/html/xk/shuyou"
    ServerName www.shuyou.group
    ServerAlias shuyou.group
    ErrorLog logs/shuyou_error.log
    CustomLog logs/shuyou_access.log common
    </VirtualHost>

    <VirtualHost *:80>
    ServerName www.lizhi.group

    DocumentRoot "/var/www/html/xk/lizhi"
    ErrorLog logs/lizhi_error.log
    CustomLog logs/lizhi_access.log common
    </VirtualHost>

    <VirtualHost *:80>
    ServerName lishuyou.com
    RedirectMatch permanent ^/(.*) http://www.lishuyou.com/$1
    </VirtualHost>

    <VirtualHost *:80>
    ServerName www.lsy.com
    RedirectMatch permanent ^/(.*) http://www.lishuyou.com/$1
    </VirtualHost>

    禁用一个或多个ip访问

    <Directory "/var/www/html">
    Order deny,allow

    Allow from 0.0.0.0
    deny from 192.168.1.153
    </Directory>

    定义跳转,让访问apache域名的某目录跳转到二级域名中去

    <VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html/xk
    ServerName www.chinaxiaokang.com
    RedirectMatch 301 /news/(.*) http://news.chinaxiaokang.com//$1
    RedirectMatch 301 /yulepindao/(.*) http://yule.chinaxiaokang.com//$1
    RedirectMatch 301 /tupian/(.*) http://tupian.chinaxiaokang.com//$1
    RedirectMatch 301 /xianyu/(.*) http://xianyu.chinaxiaokang.com//$1
    RedirectMatch 301 /m/(.*) http://m.chinaxiaokang.com//$1
    RedirectMatch 301 /m/(.*) https://m.chinaxiaokang.com//$1
    #ServerAlias chinaxiaokang.com
    ErrorLog logs/xiaokang-error_log
    # CustomLog logs/xiaokang-access_log common
    CustomLog "|/usr/sbin/rotatelogs /var/log/httpd/%Y%m%d_xiaokang_access_log 86400 480" common
    </VirtualHost>

    如下是:单域名跳转

    <VirtualHost *:80>
    ServerName chinaxiaokang.com
    RedirectMatch permanent ^/(.*) http://www.chinaxiaokang.com/$1
    </VirtualHost>

    <VirtualHost *:80>
    ServerName www.cnxk.com
    RedirectMatch permanent ^/(.*) http://www.chinaxiaokang.com/$1
    </VirtualHost>

    魅力男神
  • 相关阅读:
    CF833B The Bakery (线段树+DP)
    NOIP 2017 时间复杂度 (模拟)
    NOI 2018 屠龙勇士 (拓展中国剩余定理excrt+拓展欧几里得exgcd)
    中国剩余定理(excrt) 模板
    后缀自动机 模板
    luogu P4248 [AHOI2013]差异
    luogu P3975 [TJOI2015]弦论
    luogu P4770 [NOI2018]你的名字
    luogu P3726 [AH2017/HNOI2017]抛硬币
    luogu P3722 [AH2017/HNOI2017]影魔
  • 原文地址:https://www.cnblogs.com/capable/p/7397427.html
Copyright © 2011-2022 走看看