简体   繁体   English

使用 SSL 将 Apache 设置为 VPS 上的正向代理

[英]Set Apache as a Forward proxy on VPS with SSL

I have a React app with express server listening port 3000 deployed on VPS (which has some IP 123.123.123.123) with Apache.我有一个 React 应用程序,在 VPS 上部署了快速服务器监听端口 3000(其中有一些 IP 123.123.123.123)和 Apache。 Also I have SSL setup.我也有 SSL 设置。 The problem I have is that on page refresh/direct path entering I'm getting 404 error.我遇到的问题是在页面刷新/直接路径输入时出现 404 错误。 But everything is working fine once I set example.com:3000/page.但是,一旦我设置了 example.com:3000/page,一切正常。 At the moment I have .htaccess file with this setup:目前我有这个设置的 .htaccess 文件:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Which redirects to https.重定向到 https。

I need forward proxy setup to be done correctly to port 3000.我需要正确设置转发代理到端口 3000。

Any help with this setup will be very helpful as I'm stuck with the development.由于我坚持开发,因此对此设置的任何帮助都将非常有帮助。

Regards,问候,

You will need to setup a reverse proxy on your Apache to redirect traffic on port 443 to port 3000. It can be done by adding the following lines in your Apache config您需要在 Apache 上设置反向代理,以将端口 443 上的流量重定向到端口 3000。可以通过在 Apache 配置中添加以下行来完成

ProxyPreserveHost On
ProxyPass / http://0.0.0.0:3000/
ProxyPassReverse / http://0.0.0.0:3000/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM