Replaces Node JS PHP
Can I replace Apache with Node.js?
I have a website on CentOS with the usual suspects (Apache, MySQL and PHP). It has evolved quite a bit since this website launched, and now I want to do more fancy things with it - real-time notifications. From what I've read, Apache handles it badly. I wonder if I can just replace Apache with Node.js (so instead of "LAMP" "LNMP").
I tried looking for a solution online but couldn't find any. If I interpret the things I've read correctly, most people seem to be saying that Node.js can replace both Apache and PHP together. However, I have a lot of existing PHP code, so I would prefer to keep it.
If it's not already obvious, I'm pretty confused and could use some enlightenment. Many Thanks!
Node.js may be faster than Apache thanks to its eventful / non-blocking architecture, but you may have trouble finding modules / libraries to replace some of Apache's functionality.
Node.js itself is a lightweight, low-level framework that allows you to create server-side content and real-time parts of your web applications relatively quickly. However, Apache offers much more extensive configuration options and "classic" web server-oriented functions.
I'd say if you don't want to replace PHP with a node.js-based web application framework like express.js, then you should stick with Apache (or consider migrating to Nginx if you're having performance issues).
I believe Node.js is the future in web serving, but if you have a lot of existing PHP code, Apache / MySQL are your best bet. Apache can be configured to forward requests to Node.js, or Node.js can forward requests to Apache, but I believe there is some performance hit in either case, especially the first one. Not a big deal if you don't have a very busy website.
I just registered with stackoverflow and still can't comment on the accepted answer. Today I created a simple Node.js script that uses sendfile () to serve files over the HTTP protocol. (The existing example referenced by the accepted answer only uses pure TCP protocol to send the file, and I couldn't find an example of HTTP, so I wrote it myself.)
So I thought someone might find this useful. Providing files via the sendfile () operating system call is not necessarily faster than copying data via "user country", but it uses less CPU and RAM and can therefore process a greater number of connections than in the conventional way.
The link: https://gist.github.com/1350901
Previous SO post detailing exactly what I'm saying (php + socket.io + node)
I think you could set up a node server on somehost: tag 8000 with socket.io and the socket.io client code, and with minimal effort, rock your existing app with socket.io (real-time baby) without a ton of work.
While the node can be your only backend server, keep in mind that the node likes to live up to its name and becomes a node. I read a talk Ryan Dahl gave to a PHP user group some time ago and he mentioned the Name Node, which refers to a vision of multiple node processes working and talking to each other.
Its LAMP versus MEANING nowadays. For a direct comparison see http://tamas.io/what-is-the-mean-stack.
Of course, M, E and A are somewhat variable. For example, the newer Koa can replace (E) xpress.
However, replacing Apache with Node.js is probably not the way to go about modernizing your webstack.
- What is this song name
- When did the wheat harvest begin?
- What is Airbnb's problem
- Did cargo cults really exist?
- Why do I want a child
- What is the price of Maya software
- How can a cold cause neck pain
- The Samsung A50 has screen mirroring
- How can I make studying geography a pleasure?
- Why is Forbes so against Apple lately
- How is the economy affecting my life?
- Overclocking will void the guarantee
- What does LEAN do with BPM
- How can you make money with Qzone
- What is Al Green's most successful song
- Why do people fear gore
- What color of pants goes with an olive shirt
- Is the Indian education system out of date
- All fluorescent starters have
- Liberals believe in a strong country
- Which AI tool are you using
- Where can I make brushes
- What are the types of business markets
- Is geometry easier than algebra 1