Apache2.4中的反向代理配置
Apache按照路由规则同时解析php和反向代理到底层sockets
apache反向代理配置
<VirtualHost *:80>
SetEnv HOSTNAME jiaofu.io
DocumentRoot "/var/www/html/public"
ServerName ${HOSTNAME}
<Directory "/var/www/html/public">
Options FollowSymlinks Includes
AllowOverride All
Require all granted
</Directory>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyPassMatch "^/.*\.php(/.*)?$" !
ProxyPassMatch "^/static" !
ProxyPassMatch "^/(auth/login|auth/logout|auth/logininitstg|auth/loginstg|console|plusLoginInitNew)(.*)" !
ProxyPassMatch "^/(production|staging|develop)(.*)" !
ProxyPassMatch "^/(bootstrap|app_banner|app|js|css|images|faq|fonts|legacy|push|storeimg|terms|userextract|userextractzip|favicon.ico)(.*)" !
ProxyPassMatch "^/faq/(.*)" !
ProxyPass / http://127.0.0.1:8500/
ProxyPassReverse / http://127.0.0.1:8500/
</VirtualHost>
-
ProxyPassMatch 位置越靠上,优先级越高。
-
测试apache 配置文件
apachectl configtest