Apache多端口HTTPS 我的配置 使用Bitnami的AWS Lightsail 在端口3000上运行 在端口3001上运行的Express 使用Bitnami脚本的HTTPS(使用Let's encrypt) 我想要什么 来自或前往的任何电话。(添加WW+https) 我在3001端口上的Express API也可以使用HTTPS 目前正在工作的是什么 所有前端重定向工作正常 什么不起作用 我的Express API通过HTTP工作,但我在尝试访问时出现错误www.ipos.fun意外地关闭了连接。 我试过的

Apache多端口HTTPS 我的配置 使用Bitnami的AWS Lightsail 在端口3000上运行 在端口3001上运行的Express 使用Bitnami脚本的HTTPS(使用Let's encrypt) 我想要什么 来自或前往的任何电话。(添加WW+https) 我在3001端口上的Express API也可以使用HTTPS 目前正在工作的是什么 所有前端重定向工作正常 什么不起作用 我的Express API通过HTTP工作,但我在尝试访问时出现错误www.ipos.fun意外地关闭了连接。 我试过的,apache,https,proxy,bitnami,Apache,Https,Proxy,Bitnami,请在下面找到我的所有配置,但我认为重要的一点是: ProxyPass / http://localhost:3000/ ProxyPassReverse / http://localhost:3000/ 我想有一个匹配的基础上端口号,但似乎没有工作。 我还尝试了以下url 我试图创建多个VirtualHost来对端口号进行模式匹配,但没有成功 问题: 如何使端口3001上的Express API兼容HTTPS 这是我的配置: # Default Virtual Host configurati

请在下面找到我的所有配置,但我认为重要的一点是:

ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
我想有一个匹配的基础上端口号,但似乎没有工作。 我还尝试了以下url

我试图创建多个
VirtualHost
来对端口号进行模式匹配,但没有成功

问题: 如何使端口3001上的Express API兼容HTTPS

这是我的配置:

# Default Virtual Host configuration.

<IfVersion < 2.3 >
  NameVirtualHost *:80
  NameVirtualHost *:443
</IfVersion>


<VirtualHost _default_:80>
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  RewriteEngine On
  # BEGIN: Enable HTTP to HTTPS redirection
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
  RewriteCond %{REQUEST_URI} !^/\.well-known
  RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
  # END: Enable HTTP to HTTPS redirection
  # BEGIN: Enable non-www to www redirection
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
  RewriteCond %{REQUEST_URI} !^/\.well-known
  RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=permanent,L]
  # END: Enable non-www to www redirection
  <Directory "/opt/bitnami/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
      Require all granted
    </IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html

  # Bitnami applications installed with a prefix URL (default)
  Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>

# Default SSL Virtual Host configuration.

<IfModule !ssl_module>
  LoadModule ssl_module modules/mod_ssl.so
</IfModule>

Listen 443
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite "..."
SSLPassPhraseDialog  builtin
SSLSessionCache "shmcb:/opt/bitnami/apache2/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300

<VirtualHost _default_:443>
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  RewriteEngine On
  # BEGIN: Enable non-www to www redirection
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
  RewriteCond %{REQUEST_URI} !^/\.well-known
  RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=permanent,L]
  # END: Enable non-www to www redirection
  SSLEngine on
SSLCertificateFile "/opt/bitnami/apache2/conf/ipos.fun.crt"
SSLCertificateKeyFile "/opt/bitnami/apache2/conf/ipos.fun.key"

  <Directory "/opt/bitnami/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
      Require all granted
    </IfVersion>
  </Directory>

    ProxyRequests off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>


    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/


  # Error Documents
  ErrorDocument 503 /503.html

  # Bitnami applications installed with a prefix URL (default)
  Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>

# Bitnami applications that uses virtual host configuration
Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf"
#默认虚拟主机配置。
名称虚拟主机*:80
名称虚拟主机*:443
DocumentRoot“/opt/bitnami/apache2/htdocs”
重新启动发动机
#开始:启用HTTP到HTTPS重定向
重写cond%{HTTPS}=在…上
重写cond%{HTTP_HOST}^(localhost | 127.0.0.1)
重写条件%{REQUEST\u URI}!^/\。众所周知的
重写规则^/(*)https://%{SERVER_NAME}/$1[R,L]
#结束:启用HTTP到HTTPS重定向
#开始:启用非www到www重定向
重写cond%{HTTP_HOST}^www\。[北卡罗来纳州]
重写cond%{HTTP_HOST}^(localhost | 127.0.0.1)
重写条件%{REQUEST\u URI}!^/\。众所周知的
重写规则^(.*)$http://www.%{HTTP_HOST}%{REQUEST_URI}[R=permanent,L]
#结束:启用非www到www重定向
选项索引跟随符号链接
允许超越所有
命令允许,拒绝
通融
= 2.3 >
要求所有授权
#错误文档
错误文档503/503.html
#使用前缀URL安装的Bitnami应用程序(默认)
包括“/opt/bitnami/apache2/conf/bitnami/bitnami apps prefix.conf”
#默认SSL虚拟主机配置。
LoadModule ssl\u module modules/mod\u ssl.so
听我说
SSLProtocol all-SSLv2-SSLv3
SSLHonorCipherOrder开启
SSLCipherSuite“…”
SSLPassPhraseDialog内置
SSLSessionCache“shmcb:/opt/bitnami/apache2/logs/ssl_scache(512000)”
SSLSessionCacheTimeout 300
DocumentRoot“/opt/bitnami/apache2/htdocs”
重新启动发动机
#开始:启用非www到www重定向
重写cond%{HTTP_HOST}^www\。[北卡罗来纳州]
重写cond%{HTTP_HOST}^(localhost | 127.0.0.1)
重写条件%{REQUEST\u URI}!^/\。众所周知的
重写规则^(.*)$https://www.%{HTTP_HOST}%{REQUEST_URI}[R=permanent,L]
#结束:启用非www到www重定向
斯伦金安
SSLCertificateFile“/opt/bitnami/apache2/conf/ipos.fun.crt”
SSLCertificateKeyFile“/opt/bitnami/apache2/conf/ipos.fun.key”
选项索引跟随符号链接
允许超越所有
命令允许,拒绝
通融
= 2.3 >
要求所有授权
代理请求关闭
命令拒绝,允许
通融
ProxyPass/http://localhost:3000/
ProxyPassReverse/http://localhost:3000/
#错误文档
错误文档503/503.html
#使用前缀URL安装的Bitnami应用程序(默认)
包括“/opt/bitnami/apache2/conf/bitnami/bitnami apps prefix.conf”
#使用虚拟主机配置的Bitnami应用程序
包括“/opt/bitnami/apache2/conf/bitnami/bitnami apps vhosts.conf”

一种解决方案是在VirtualHost:443中添加路由

ProxyPass /api/ http://localhost:3001/
ProxyPassReverse /api/ http://localhost:3001/
这就是我之前提到的,我只是在端口3001上测试,而不是在端口HTTPS 443上测试

ProxyPass /api/ http://localhost:3001/
ProxyPassReverse /api/ http://localhost:3001/