vantage5353
vantage5353

Reputation: 565

Do I need a server written in node.js instead of a regular nginx/Apache?

I'd like to use node.js to add basic functionality to a static site:

The examples at nodejs.org show how to start a server, written in JS, but coding an entire http server seems to be an overkill, and definitely doesn't strike me as a very secure solution. Is this really necessary when a standard web server can be used?

What would be the most straightforward way of integrating node.js code behind a server like nginx?

Upvotes: 1

Views: 214

Answers (2)

Salvatorelab
Salvatorelab

Reputation: 11873

You can use Apache and Node.js at the same time, on different ports.

Let Apache handle HTTP, and use Node.js on other port to handle your chat, or your real time notification system or whatever you want to do with Node.js

You don't have to use Node.js to serve HTML if you don't want to do so. In fact it's not a good idea, unless you really expect a benefit (because your server will handle tons if IO or if you have such a small/simple web that you don't need a monster like Apache behind).

Upvotes: 1

Matthew Sullivan
Matthew Sullivan

Reputation: 78

If you don't know you need node.js then you probably don't. Node is really meant for real-time applications and highly available and dynamic content being accessed thousands of times per second. For what it sounds like you are making it might be best to use a less efficient but easier solution from the Ruby side. Ruby is super easy to learn and has many great beginner documents. Specifically look into Ruby on Rails and Sinatra.

Another more practical option would be to skip all of this and just use Wordpress. I work for a web development company and 90% of sites end of being wordpress, even the dynamic ones. Wordpress has a huge library of plugins and apis to allow for ultra-customizability. For Wordpress' true power it is best to use a private hosting of it from wordpress.org rather than a shared hosting like wordpress.com.

Upvotes: 1

Related Questions