将我的域名重定向到特定端口

时间:2023-02-01 18:14:26

I currently have a website running under apache on my VPS, but i'm planning to run another website with NodeJS.

我目前在我的VPS上有一个在apache下运行的网站,但我打算用NodeJS运行另一个网站。

Since apache runs on port 80 and NodeJS on port 3000 i was wondering how i could manage that when someone type the domain name domain.com, it binds to the port 3000 ?

由于apache在端口80和端口3000上的NodeJS上运行,我想知道如何在有人键入域名domain.com时管理它,它会绑定到端口3000吗?

Also, is it possible that after the redirect on the browser it shows only http://domain.com and not http://domain.com:3000 ?

此外,有可能在浏览器上重定向后,它只显示http://domain.com而不是http://domain.com:3000?

1 个解决方案

#1


1  

Use ProxyPass:

使用ProxyPass:

<VirtualHost *:80>
    ServerName domain.com
    ProxyRequests Off
    ProxyPass / http://domain.com:3000/
    ProxyPassReverse / http://domain.com:3000/
</VirtualHost>

#1


1  

Use ProxyPass:

使用ProxyPass:

<VirtualHost *:80>
    ServerName domain.com
    ProxyRequests Off
    ProxyPass / http://domain.com:3000/
    ProxyPassReverse / http://domain.com:3000/
</VirtualHost>