简体   繁体   English

节点js与apache或nginx?

[英]Node js with apache or nginx?

我想使用apache / nginx加载静态内容,然后使用php,然后使用node js在同一页面上做一些实时应用程序,哪一种是最好的选择?

Both will do fine. 两者都可以。 Anything other than that will veer into opinion. 除此之外,其他任何事情都会引起人们的注意。

Saying that here's my (brief) opinion: 说这是我的(简短)意见:

Apache has been round longer and to some it's more established, with more features and support. Apache已经运行了更长的时间,并且在某些方面已经建立了更多的功能和支持。 Any new module or software you want will almost certainly work with Apache. 您想要的任何新模块或软件都几乎可以与Apache一起使用。 To others it's staid and stuck in the past. 对于其他人来说,它是僵持的,并且停留在过去。

Nginx is quicker (though honestly you'll struggle to see the difference except for very high volume sites) and has quickly become the web server of choice for a lot of people if you don't have any specific need for Apache for your code. Nginx速度更快(虽然老实说,您将很难看到区别,但网站数量非常大),并且如果您的代码不需要Apache的话,Nginx已迅速成为许多人的Web服务器。 So a lot more newer projects seem to choose Nginx. 因此,似乎有更多新项目选择了Nginx。

Ultimately both with allow proxying to Node so either will do. 最终两者都允许代理到Node,所以两者都可以。

If you want to use PHP just to load the stuff from the database for Node, I strongly recommend to instead use the mysql module for Node.js. 如果您只想使用PHP从数据库中为Node加载内容,则强烈建议您为Node.js使用mysql模块。 I installed it and wrote all the code my project needed in about an hour. 我安装了它,并在大约一个小时内编写了项目所需的所有代码。 You simply make all the queries from inside Node, which is awesome. 您只需在Node内部进行所有查询,这真是棒极了。

As for the server, I use Apache (XAMPP) and it works perfectly. 至于服务器,我使用Apache(XAMPP),它运行良好。

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

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