与Apache配合使用
- LoadModule proxy_module /yyypath/modules/mod_deflate.so
- <IfModule deflate_module>
- SetOutputFilter DEFLATE
- DeflateCompressionLevel 2
- AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml application/x-httpd-php image/jpeg image/gif image/png font/ttf font/otf image/svg+xml
- </IfModule>
-
- <VirtualHost *:80>
- # 别忘了绑Host哟
- ServerName www.laravels.com
- ServerAdmin hhxsv5@sina.com
-
- DocumentRoot /xxxpath/laravel-s-test/public;
- DirectoryIndex index.html index.htm
- <Directory "/">
- AllowOverride None
- Require all granted
- </Directory>
-
- LoadModule proxy_module /yyypath/modules/mod_proxy.so
- LoadModule proxy_module /yyypath/modules/mod_proxy_balancer.so
- LoadModule proxy_module /yyypath/modules/mod_lbmethod_byrequests.so.so
- LoadModule proxy_module /yyypath/modules/mod_proxy_http.so.so
- LoadModule proxy_module /yyypath/modules/mod_slotmem_shm.so
- LoadModule proxy_module /yyypath/modules/mod_rewrite.so
-
- ProxyRequests Off
- ProxyPreserveHost On
- <Proxy balancer://laravels>
- BalancerMember http://192.168.1.1:5200 loadfactor=7
- #BalancerMember http://192.168.1.2:5200 loadfactor=3
- #BalancerMember http://192.168.1.3:5200 loadfactor=1 status=+H
- ProxySet lbmethod=byrequests
- </Proxy>
- #ProxyPass / balancer://laravels/
- #ProxyPassReverse / balancer://laravels/
-
- # Apache处理静态资源,LaravelS处理动态资源。
- RewriteEngine On
- RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
- RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
- RewriteRule ^/(.*)$ balancer://laravels/%{REQUEST_URI} [P,L]
-
- ErrorLog ${APACHE_LOG_DIR}/www.laravels.com.error.log
- CustomLog ${APACHE_LOG_DIR}/www.laravels.com.access.log combined
- </VirtualHost>