一般一个域名建立一个conf,然后在主域名中Include
Include conf/extra/denyip.conf
Include conf/extra/vhosts/*.conf
单个域名的配置
<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 >
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。