apache系列(虛擬域名)

通常一個域名創建一個conf,而後在主域名中Include
Include conf/extra/denyip.conf
Include conf/extra/vhosts/*.confcss

單個域名的配置web

<VirtualHost *:80>

    ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot /home/admin_dev/lotusprize

    ServerName lotusprize.com

    ServerAlias www.lotusprize.com    #ErrorLog /home/admin_dev/lotusprize_error.logs

    #CustomLog /home/admin_dev/lotusprize_access.logs

    <Directory "/home/admin_dev/lotusprize">

        Options  FollowSymLinks

        AllowOverride All

    Require all granted    </Directory>

 

    #反向代理部分,須要開啓proxy,proxy_http,proxy_balancer(負載均衡)等模塊

    ProxyRequests Off

    ProxyPass  /lp/css !
    ProxyPass  /lp/images !  #表示不代理

   ProxyPass /newchannel  http://www.example.com/newchannel

   ProxyPa***everse /newchannel  http://www.example.com/newchannel

  

    #反向代理

    ProxyPassMatch    /travel/dataUpdate(.json)?  balancer://cluster/bundle-app/dataUpdate$1 nofailover=Off  maxattempts=3   

     #負載均衡

     <proxy balancer://cluster>

              BalancerMember http://localhost:7000 loadfactor=1 retry=60

          BalancerMember http://localhost:8000 loadfactor=1 retry=60

          ProxySet lbmethod=byrequests     </proxy>

 

    #反向代理

    ProxyPass /travel/bundle-app balancer://cluster/bundle-app nofailover=Off  maxattempts=3

   #加上下面這句地址欄不變化

   ProxyPa***everse /travel/bundle-app balancer://cluster/bundle-app

   <proxy balancer://cluster>

        BalancerMember http://localhost:7000 loadfactor=1 retry=60

        BalancerMember http://localhost:8000 loadfactor=1 retry=60

        ProxySet lbmethod=byrequests   </proxy>

   若是多個項目負載均衡,balancer://cluster這個值是要自定義的,不能同名能夠是balancer://clusterinfo等等。

 

    #指定別名(fpm模式下不可用,而且不可用於百度的統計子目錄,須要開始alias模塊)

    Alias /travel "/home/admin_dev/travel/"

    <Directory "/home/admin_dev/travel/">

        Options FollowSymLinks

        AllowOverride All        #Allow from All低版本配置

        #Require all granted高版本配置,本人使用的2.4

       <RequireAll>
            Require all granted
            Require not ip 37.187.93.149 192.99.32.119 192.99.32.120 192.99.32.117
        </RequireAll>

    </Directory>
</VirtualHost >
相關文章
相關標籤/搜索