Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a server which has one static IP address (let's say it's x.x.x.x). How can I set up multiple websites on this server?

What I can think of is creating multiple website and publish them through different ports. So I can access website 1 from x.x.x.x:8081 and website 2 from x.x.x.x:8082 etc. Then register different domains and point to x.x.x.x:8081 and x.x.x.x:8082 separately. Is that the correct way? This is the first time I'm doing this kind of work and I lack of confidence. Can anyone point me the right direction?

Also can anyone describe how to configure the domain(s) in my situation? Thanks.

share|improve this question
    
What server software are you using? Apache? Lighttpd? –  Jorge Fuentes González May 27 '13 at 13:39
1  
this is exactly the reason why the host header was made mandatory in http 1.1 –  ratchet freak May 27 '13 at 15:17

4 Answers 4

As suggested, virtual hosts will allow this. I just want to add that since you are going to register different domains, you do NOT need to use a separate port for each. Each domain can use e.g. port 80. Apache will figure out which virtual host to use by the name.

share|improve this answer

What you need to set up are virtual hosts. I'm going to take a wild guess and assume you are running apache. There are instructions on the apache website which will point you in the right direction. Every webserver I can think of supports virtual hosts of some kind, so if you don't run apache, you'll have to google instructions for your webserver accordingly.

share|improve this answer

It depends on the web server software, but I think today most servers (certainly Apache) offers multiple sites through the same IP (the web browsers, connecting the server request the name of the site too).

The name to look for (google for) is "virtual host", e.g. here is a link showing an example with the Apache server.

share|improve this answer

As suggested before , Apache can do this , check this : http://www.thegeekstuff.com/2011/07/apache-virtual-host/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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