一、背景需求
1、开发同事 nodejs 开发项目,node index.js 开启9003服务端口的监听服务,现在需要外部通过https 访问该服务
2、搭建apache2服务
1)80端口http访问,配置/etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80> ?????ProxyPreserveHost On ?????ServerAdmin admin@qq.com ?????ServerName ?deploy-cn.domains.com ?????DocumentRoot /home/guyan/www/watchfaces ????DirectoryIndex homepage.htm index.html login.htm ?????ProxyPass / http://127.0.0.1:9003/ ?????ProxyPassReverse / http://127.0.0.1:9003/ ?</VirtualHost> ?<Directory "/home/guyan/www/watchfaces"> ???????Options Indexes FollowSymLinks ?????AllowOverride None ????????Order allow,deny ?????Allow from all ?</Directory>
2) 443端口https 访问,需要配置1)80端口http访问,配置/etc/apache2/sites-enabled/001-ssl.conf
<virtualhost *:443>ServerName deploy-cn.huami.com<proxy>Order deny,allowAllow from all</proxy>SSLEngine OnSSLProxyEngine OnSSLProxyVerify noneSSLProxyCheckPeerCN offSSLProxyCheckPeerName offSSLCertificateFile "/etc/apache2/ssl/huami.com.crt"SSLCertificateKeyFile "/etc/apache2/ssl/huami.key" ProxyRequests OffProxyPreserveHost On ProxyPass / http://127.0.0.1:9003/ProxyPassReverse / http://127.0.0.1:9003/</virtualhost>
Apache2 实现https访问http服务
原文地址:https://www.cnblogs.com/songfucai/p/8379325.html