作者:OP尋一 | 来源:互联网 | 2023-02-01 16:58
一般一个域名建立一个conf,然后在主域名中IncludeIncludeconfextradenyip.confIncludeconfextravhosts*.conf单个域名的配置
一般一个域名建立一个conf,然后在主域名中Include
Include conf/extra/denyip.conf
Include conf/extra/vhosts/*.conf
单个域名的配置
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
Options FollowSymLinks
AllowOverride All
Require all granted
#反向代理部分,需要开启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
#负载均衡
BalancerMember http://localhost:7000 loadfactor=1 retry=60
BalancerMember http://localhost:8000 loadfactor=1 retry=60
ProxySet lbmethod=byrequests
#反向代理
ProxyPass /travel/bundle-app balancer://cluster/bundle-app nofailover=Off maxattempts=3
#加上下面这句地址栏不变化
ProxyPa***everse /travel/bundle-app balancer://cluster/bundle-app
BalancerMember http://localhost:7000 loadfactor=1 retry=60
BalancerMember http://localhost:8000 loadfactor=1 retry=60
ProxySet lbmethod=byrequests
如果多个项目负载均衡,balancer://cluster这个值是要自定义的,不能同名可以是balancer://clusterinfo等等。
#指定别名(fpm模式下不可用,并且不可用于百度的统计子目录,需要开始alias模块)
Alias /travel "/home/admin_dev/travel/"
Options FollowSymLinks
AllowOverride All #Allow from All低版本配置
#Require all granted高版本配置,本人使用的2.4
Require all granted
Require not ip 37.187.93.149 192.99.32.119 192.99.32.120 192.99.32.117