我的config
- 使用Bitnami的AWS Lightsail
- 在端口3000上运行的反应
- 在端口3001上运行Express
- https使用Bitnami脚本(使用Let's Encrypt(
我想要的
- https://www.ipos.fun/或https://ipos.fun/或ipos.fun/或www.ipos.fun/访问https://www.ipos.fun/。(添加wwww https(
- 我在端口3001上的Express API也可以使用https。
当前工作的功能
- 所有前端重定向工作正常。
什么不起作用
- 我的Express API在http上起作用,但是当我尝试访问https://www.ipos.fun:3001/。 时,我有错误
www.ipos.fun unexpectedly closed the connection.
。我尝试的
请在下面找到我的所有配置,但我认为重要的是:
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
我想根据端口号进行匹配,但似乎没有用。我还尝试使用url https://www.ipos.fun:3001/api/
尝试了以下内容。ProxyPass /api http://localhost:3001/
ProxyPassReverse /api http://localhost:3001/
我尝试创建多个VirtualHost
以在端口号上进行模式匹配,但它不起作用。
问题
如何在符合端口3001 HTTPS上使我的快递API?
这是我的配置:
# 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"
一种解决方案是在VirtualHost中添加路由:443,
ProxyPass /api/ http://localhost:3001/
ProxyPassReverse /api/ http://localhost:3001/
这是我之前提到的,我只是在端口3001上进行测试,而不是端口https 443。