Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6877757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:38:22+00:00 2026-05-27T04:38:22+00:00

I am trying to run Apache and node.js on the same Amazon EC2 instance.

  • 0

I am trying to run Apache and node.js on the same Amazon EC2 instance. After research online, I came up with the following solution:

  1. run Apache on port 9000

  2. run node.js apps on port 8001, 8002 and so on.

  3. create a reverse proxy in node.js, running on port 80. It routes requests to different ports based on the hostname.

This solution works. (Although I haven’t found a way to start node.js automatically)
My question is, will running multiple node instance causes performance degradation? Or will the reverse proxy be a problem?

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:38:22+00:00Added an answer on May 27, 2026 at 4:38 am

    Performance Degradation

    On the contrary. If all you do with node is proxying, the overload is insignificant (as compared to apache’s). I do have a quite similar setup as yours (small virtual machine, 3 legacy apache websites, node.js proxying and enhancement). So far, apache is the resource eater, not my node apps, which nonetheless proxy/filter/intercept every incoming http request

    Here’s my setup :

    main proxy

    which handles all incoming requests (for as many domains as you like) : I personally use nodejitsu’s http-proxy which is very robust and simple to configure

    var http = require('http');
    var httpProxy = require('http-proxy');
    var options = {
    
      hostnameOnly: true,
      router: {    
        'domain1.com': '127.0.0.1:8081',
        'www.domain1.com': '127.0.0.1:8081',
        'subdomain1.domain1.com': '127.0.0.1:8082',
    (...)
        'domain2.com': '127.0.0.1:8090',
    (...)
    
       }
    }
    
    var mainProxy = httpProxy.createServer(options);
    mainProxy.listen(8080);
    

    You can redirect to apache directly from the option object, or do some more url parsing in another (middleware) node app on a different port.

    WARN: if you don’t wish to install/run node as ‘root’ (which I’d strongly advise in a production environement) : redirect port 80 to some other port with an IPTABLE directive (let’s say 8080) where this proxy runs (see here for detailed example of Iptable directives). Mine, on a debian squeeze, reads :

    #REDIRECT port 80 to 8080
    $IPTABLES -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
    

    node apps

    which do some URL parsing with regexes, or whatever you need. Ex: redirect to a few (legacy) apache servers which (in my case) only serve legacy content not yet served by the ‘in developement’ node apps.

    Daemonisation

    There are several solutions to make node run as a daemon. My favorite two are :

    • nodemon will monitor all files in your node app folder and subfolder for change and restart the node app on file change. It’s perfect for a development environment
    • forever (yet again by Nodejitsu) will restart your node app if ever it stops. It’s very customisable.

    Also :

    • init.d script : I’ve written this debian init.d script for my own servers (should work on ubuntu)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run some python code under Apache 2.2 / mod_python 3.2.8. Eventually
I'm trying to run the Camel Example camel-example-spring-jms (also at http://activemq.apache.org/camel/tutorial-jmsremoting.html ). However, when
Trying to run the following command in php to run powershell command... the following
Trying to run my program in FreeBSD OS, I have the following results: $
Hey, I'm trying to run Apache Tomcat 6.0.26 on Mac OS X - Snow
I am trying to run python in an Apache WS in a linux RHEL
I am trying to run the CMIS client example on: http://incubator.apache.org/chemistry/opencmis-api-examples.html Unfortunately I can't
When I am trying to run tomcat using startup.bat I get the following error,
I am trying to run CherryPy behind Apache using mod_rewrite, as described in the
I am trying to run this example http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/doc/PoolingDataSourceExample.java?view=markup but somehow I am not able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.