I would like to have a directory like this:
- apps
- game01
- game02
- game03
- app01
apps game01 game02 game03 app01
And when someone goes to my "domain.com/game01" will be managed by the node instance that runs game01.
当有人进入我的“domain.com/game01”时,将由运行game01的节点实例管理。
Node solution:
- I don't like to use nginx because adds another layer of settings to the machine, so when I want to change to another machine I have to configure nginx too and I would like to don't have to.
- I would like to have some kind of versioning of my configuration file.
- I understand that nginx is more secure and performant;
我不喜欢使用nginx,因为在机器上添加了另一层设置,所以当我想换到另一台机器时,我也必须配置nginx而且我不想这样做。
我想对我的配置文件进行某种版本控制。
我知道nginx更安全,更高效;
Why should I need to have multiple instances of node and not just one to handle all apps:
- Every app (game01, game02) might have sockets attached too. So I would like to run the same code in the development settings. I want to run minimal different code in the production than in development.
每个应用程序(game01,game02)也可能附加套接字。所以我想在开发设置中运行相同的代码。我想在生产中运行最少的不同代码而不是在开发中。
What I'm thinking:
Create a new node.js application where runs on port 443 (because some of them need ssl) and when someone requests (domain.com/game01) will create a new node.js instance with forever and will delegate to this one.
创建一个新的node.js应用程序,在端口443上运行(因为其中一些需要ssl),当有人请求(domain.com/game01)将永远创建一个新的node.js实例并将委托给这个。
What do you think about my solution? What flaws might have? What is the best suggestion for this?
您对我的解决方案有何看法?可能有什么缺陷?对此最好的建议是什么?
(If you can tell my that nginx is a lot better than this solution I might try the nginx solution, at least some versioning)
(如果你能告诉我nginx比这个解决方案要好很多,我可能会试试nginx解决方案,至少有一些版本)
thanks (:
1 个解决方案
#1
1
Write a reverse proxy as the main request handler using the http-proxy module. You can have each game running it's own app server and listening for HTTP requests on the loopback IP with an assigned port. The proxy just maps incoming request paths (/game01) to back end server port numbers (3001, for example).
使用http-proxy模块将反向代理写为主请求处理程序。您可以让每个游戏运行它自己的应用服务器,并使用指定的端口侦听环回IP上的HTTP请求。代理只是将传入的请求路径(/ game01)映射到后端服务器端口号(例如3001)。
#1
1
Write a reverse proxy as the main request handler using the http-proxy module. You can have each game running it's own app server and listening for HTTP requests on the loopback IP with an assigned port. The proxy just maps incoming request paths (/game01) to back end server port numbers (3001, for example).
使用http-proxy模块将反向代理写为主请求处理程序。您可以让每个游戏运行它自己的应用服务器,并使用指定的端口侦听环回IP上的HTTP请求。代理只是将传入的请求路径(/ game01)映射到后端服务器端口号(例如3001)。