简体   繁体   中英

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. Any new module or software you want will almost certainly work with 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. So a lot more newer projects seem to choose Nginx.

Ultimately both with allow proxying to Node so either will do.

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. 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.

As for the server, I use Apache (XAMPP) and it works perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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