版本:
apache 2.4.6
tomcat 8.5.27
架构:
1、apache自带的mod_proxy架构代理转发请求到tomcat,由tomcat解析jsp(apache2.4.6的版本默认已经加载了mod_proxy,留意:Include conf.modules.d/*.conf)
2、在apache中配置https的ssl证书(证书文件是阿里云的证书,放置在目录httpd根目录下面)
3、由于是多虚拟主机架构,故不使用conf.d/ssl.conf文件,直接在httpd.conf中配置ssl站点(所以我把conf.d/ssl.conf文件清空了,否则老是报错:Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443)
如下:
修改文件:conf/httpd.conf增加虚拟主机站点
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile "/etc/httpd/cert/public.pem"
SSLCertificateKeyFile "/etc/httpd/cert/214479333460621.key"
ServerName api.vsource.cn
<Proxy *>
Options MultiViews
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://api.vsource.cn:9090/ #设置转发
ProxyPassReverse / http://api.vsource.cn:9090/
</VirtualHost>