0

I'm coming from a LAMP background and want to test out node for production.

What seems a little confusing to me is that in Apache url's map to folders, and the server will automatically look for an index.html or index.php if you aren't re-writing urls.

What would the equivalent be in node?

I'm thinking it'd be something like checking the request url and matching it, then loading a specific node module which runs the app.

This might seems simple for a single app, but we run tons of client apps on our server so i'm used to having different frameworks in different folders and index.php just runs it.


to be more specific. i'm currently running a few codeigniter and wordpress installations on our server. so i'd want to run a few node apps/frameworkds in different 'subfolders'

8
  • 2
    Node isn't a file server, it's an application server. You would start it like this: node app.js. The rest depends on how you write your application, i.e. the code inside app.js. Dec 6, 2011 at 18:51
  • There is no mod_node for apache. Your doing it wrong.
    – Raynos
    Dec 6, 2011 at 18:53
  • so if i have multiple apps running on one machine i have multiple instances of node running? Dec 6, 2011 at 18:53
  • @wayne correct, generally you put all these node http servers behind a single load balancer.
    – Raynos
    Dec 6, 2011 at 18:56
  • @Raynos: There is a mod_node, though I don't recommend it for production enviornment: github.com/aredridel/mod_node Dec 6, 2011 at 19:01

1 Answer 1

1

With Node you don't really use Apache. It's similar to Ruby in that is runs its own web server.

However, you can probably get Apache to run Node files using mod_node. As far as I know this is non-standard though and you definitely lose the "non-blocking" advantages of Node. But for experimenting (and not load testing) it's fine.

Check out Express if you're looking for an MVC architecture written in Node.

If you're just looking to run the most basic sample web server, just run the example hosted on the main page: http://nodejs.org/

Lastly, I had that same issue you are experiencing where I have one box hosting a lost of stuff and Apache taking up port 80. The answer here is to use a reverse proxy like Nginx to run on port 80 and redirect traffic to Apache / Node / Ruby / etc. Best of both worlds and since Nginx is written non-blocking you still gain the benefits of node.

I actually wrote an in-depth blog article about this a few months ago: http://readystate4.com/2011/07/15/nginx-apache-and-node-all-living-harmony/

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.