我很不了解http和这个主题,所以找不到足够解答我的问题的答案。如果您已经找到关于这个问题的答案,请告诉我是否重复了。
我想要实现的目标是,通常情况下它可以在 http://domain:3000 上工作,但我希望它可以在 https://domain:3000 上使用。
我安装了Let's Encrypt并在我的Apache设置文件中添加反向代理设置。因此,可以通过路径访问 https://domain/api 来访问https://domain:3000。但是,正如我上面提到的那样,我也希望在https上直接使用端口号。
我的httpd.conf上还有其他行。
我想要实现的目标是,通常情况下它可以在 http://domain:3000 上工作,但我希望它可以在 https://domain:3000 上使用。
我安装了Let's Encrypt并在我的Apache设置文件中添加反向代理设置。因此,可以通过路径访问 https://domain/api 来访问https://domain:3000。但是,正如我上面提到的那样,我也希望在https上直接使用端口号。
我的httpd.conf上还有其他行。
NameVirtualHost *:80
<VirtualHost *:80>
ServerName my.domain
ServerAlias www.my.domain *.my.domain
DocumentRoot /var/www/html
RewriteEngine on
RewriteCond %{SERVER_NAME} =my.domain [OR]
RewriteCond %{SERVER_NAME} =www.my.domain [OR]
RewriteCond %{SERVER_NAME} =*.my.domain
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
Listen 443
</IfModule>
Include /etc/httpd/conf/httpd-le-ssl.conf
<IfModule mod_proxy.c>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /api http://my.domain:3000
ProxyPassReverse /api http://my.domain:3000
</IfModule>
我需要增加更多的设置吗?还是有其他解决方法?