如何将NodeJS服务器写入现有域?

时间:2023-01-13 09:54:42

Okay so I'm in like a really weird spot.

好吧,我在一个很奇怪的地方。

I need to set up a nodejs server for a messaging app, and I want to put the server on a url I already have. I have full access my directory on that site (ex. I can access sitename.com/~mypage/) and do things with it through filezilla, but I cannot access the hardware or the base domain (ex. I can't touch sitename.com but I can access ~mypage).

我需要为一个消息应用程序设置一个nodejs服务器,我想把服务器放在我已经拥有的url上。我可以完全访问该站点上的目录(例如,我可以访问sitename.com/~mypage/),并通过filezilla对其进行处理,但我无法访问硬件或基本域(例如,我无法访问sitename.com,但我可以访问~mypage)。

how would I set up the server on there? Do I need to initialize it on my own computer then upload it or do I install nodejs on the server and initialize it there? or can I use a local host for the app? Thanks.

如何在那里设置服务器?我需要在我自己的计算机上初始化它然后上载它还是在服务器上安装nodejs并在那里初始化它?或者我可以使用本地主机来运行这个应用程序吗?谢谢。

1 个解决方案

#1


2  

if you already have a site running you won't be able to just slot a node app into ~mypage by adding it through filezilla.

如果你已经有一个站点在运行,你就不能通过filezilla添加一个节点应用程序到~mypage中。

The best way to do this in my opinion is by setting up through your domain management that ~mypage points to where you have deployed your node app (ie heroku, AWS), but if you have access to do that you may as well set up a subdomain to route to the app (ie app.sitename.com)

这样做在我看来最好的办法是通过设置您的域管理~ mypage点到你的节点部署应用程序(即heroku,AWS),但是如果你有访问,你不妨设立子域路由到应用程序(例如app.sitename.com)

However, if you really cant access the domain settings, my suggestion would be to deploy your node app on Heroku, AWS or GCP then either:

但是,如果您真的无法访问域设置,我的建议是将您的节点应用部署到Heroku、AWS或GCP上:

A) set up a a ~mypage that redirects you to your app url if someone visits it OR B) set up a page with masked forwarding like so (so the browser url stays as sitename.com/~mypage/):

A)设置一个~mypage,如果有人访问你的app url,它会将你重定向到你的app url;

<html>  
<head>
  <title>Page Title</title>
  <META name="description" content="Page Description"><META name="keywords" content="keywords, for, page">
</head>
<frameset rows="100%,*" border="0">
  <frame src="http://linktoyourapp.herokuapp.com" frameborder="0" />
  <frame frameborder="0" noresize />
</frameset>
</html>

#1


2  

if you already have a site running you won't be able to just slot a node app into ~mypage by adding it through filezilla.

如果你已经有一个站点在运行,你就不能通过filezilla添加一个节点应用程序到~mypage中。

The best way to do this in my opinion is by setting up through your domain management that ~mypage points to where you have deployed your node app (ie heroku, AWS), but if you have access to do that you may as well set up a subdomain to route to the app (ie app.sitename.com)

这样做在我看来最好的办法是通过设置您的域管理~ mypage点到你的节点部署应用程序(即heroku,AWS),但是如果你有访问,你不妨设立子域路由到应用程序(例如app.sitename.com)

However, if you really cant access the domain settings, my suggestion would be to deploy your node app on Heroku, AWS or GCP then either:

但是,如果您真的无法访问域设置,我的建议是将您的节点应用部署到Heroku、AWS或GCP上:

A) set up a a ~mypage that redirects you to your app url if someone visits it OR B) set up a page with masked forwarding like so (so the browser url stays as sitename.com/~mypage/):

A)设置一个~mypage,如果有人访问你的app url,它会将你重定向到你的app url;

<html>  
<head>
  <title>Page Title</title>
  <META name="description" content="Page Description"><META name="keywords" content="keywords, for, page">
</head>
<frameset rows="100%,*" border="0">
  <frame src="http://linktoyourapp.herokuapp.com" frameborder="0" />
  <frame frameborder="0" noresize />
</frameset>
</html>