how do I install three linux based web servers in one machine?

2

I want to install three Linux web servers on my laptop, but I want to ask if there are guides on how to do this? I heard that you will change ports, but I don't know how. Can you provide me?

The three web servers I want to install are

  • apache (already installed)
  • nginx (not installed yet)
  • lighttpd (not installed yet)

With these three web servers, I will put each of them a Wordpress template. In which I'll try to access later, but my only problem will be the installation of these three web servers without creating any conflict in my laptop.

RedKing

Posted 2012-01-08T12:41:53.727

Reputation: 422

Answers

3

Quite simply, you use different ports for them internally, then have the websites accessed by different ports or set up either ngnix or apache (or another proxy) to act as a proxy - say with a setup similar to this, to pass on requests to the right server.

For testing, using different ports is the way to go

Alternately, use 3 VMs and use seperate ip addresses for them (the best way to do so would be bridged networking with a cable for ethernet access for the laptop). This would need somewhat more resources, but be infinitely easier to troubleshoot.

Journeyman Geek

Posted 2012-01-08T12:41:53.727

Reputation: 119 122

hmm. that maybe the case.. but i am thinking that if my apache server is accessed through 127.0.0.1 then i could change the other 2 web servers,, it would be now 127.0.0.1:8000 and 127.0.0.1:6969. but i dont know how to do this. can you elaborate more? – RedKing – 2012-01-08T12:55:18.007

just add the well, thats how you do it, precisely. I haven't set up a proxy before, so i'm not sure of the details. For running on seperate ports, install, it won't start, so just go into the config, change it, and then start the process – Journeyman Geek – 2012-01-08T12:59:04.387

2Ewww - you don't need to install 3 separate VMs to use a separate IP on each web server! The IP address used by the web server will be specified in the configuration file, such as by the Apache Listen directive. – MikeyB – 2012-01-08T14:17:40.550

well, he'd need three interfaces wouldn't he? I suppose the best setup depends on how he wants to use it. – Journeyman Geek – 2012-01-08T14:38:09.660

3

By changing the configuration files of each server, you have have them listening on different ports. This way they will not conflict with each other returning a Port in Use error. However, I do agree with Journeyman Geek as running multiple VMs is ideal in my opinion. You could use something like VirtualBox's Export/Import Appliance feature that will allow you to quickly get the other two VMs copied and running. Much easier in separating the three servers in troubleshooting. Only reason why I can see you wanting to have different servers for different ports is if you were making an administrative backend to an application, but then why not just use Virtual Hosts.

APACHE

Usually in your /etc/apache2/ports.conf there is a line that tells apache which port to listen on. You will want to change this to your applicable port.

Listen 80

NGINX

When you setup this server, you'll have a configuration similar to this one where you're listening on port 81.

server {
        listen       81;
        server_name  localhost;

        access_log  logs/localhost.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }
}

LIGHTTPD

server.port = 82

kobaltz

Posted 2012-01-08T12:41:53.727

Reputation: 14 361