0

I have one dedicated server and I do have more than 1 IP address.

Could I run Nginx, Apache, LIGHTTPD and Node.js simultaneously?

I want to make tests, learn.

  • 1
    Why are you listing 3 different web servers? Only one can bind to port 80. Pick one. Last I looked, Apache runs about 70% of the net and is the most mature and stable. It will do what you want. Node.js is a JavaScript environment. It is not a server nor a server side language. It is, in effect, a library for client side scripting in web development. It is not something you run. – closetnoc Oct 7 '17 at 3:32
  • 1
    If your goal is to learn about web development, then use Apache for the reason I mentioned before. I suggest buying some O'Reilly books and stop reading online stuff. You will get much more out of it simply because it will be focused and not fragmented. – closetnoc Oct 7 '17 at 3:56
  • 2
    @Ciprian The short answer is yes. I test multiple web servers on the same server/computer all the time. You'll either need to run one at a time, or have them listen on different ports. For example, run Apache on port 80, Lighthttpd on port 81, and so on... In that case, you'll need to change the listening port in their configuration file (explaining how to do so for so many servers is outside the scope of this site). Also be aware that you'll need to open the port in your firewall for each that you'll be connecting to from a remote network (i.e., not accessing it on a local computer). – dan Oct 7 '17 at 6:04
0

You can attach each of the servers to a different IP address of the same computer. There are configuration directives for each that will do so.

Apache

Listen: https://httpd.apache.org/docs/2.4/bind.html

Nginx

Listen: http://nginx.org/en/docs/http/ngx_http_core_module.html#listen

Lighttpd

server.bind: https://redmine.lighttpd.net/projects/1/wiki/Server_bindDetails

node.js

server.listen(): https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback


However, the typical way to do this is to use a single server with one IP address. You would use either Nginx or Apache as the main server (they are the most capable).

You run the various servers on different ports. The non-standard ports (except the main server on port 80) would be firewalled and not accessible except locally. The main server would reverse proxy content from other ports for various virtual hosts.

  • Nginx could be in front of all others working as main server, right? So when a visitor comes on my Ghost blog, Nginx would pass that request to Node.js server? – Ciprian Oct 8 '17 at 12:29
  • @Ciprian Yes, you can do that. – Rob Oct 8 '17 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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