分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

Apache2 实现https访问http服务

发布时间:2023-09-06 01:40责任编辑:傅花花关键词:http

一、背景需求

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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved