Two virtual hosts with one IP and no domain

I have a virtual host that works as shown here (I changed the IP address for security reasons)

 <virtualhost 178.79.177.xx:80="">DocumentRoot /srv/www/
     ErrorLog /srv/www/
     CustomLog /srv/www/ combined</virtualhost> 

I still don't have a domain name.

Now I want to install another application in another folder, how should I do it? Can it be done without a domain?

Thank you.

2 Replies


Now I want to install another application in another folder, how should I do it? Can it be done without a domain?

Thank you.
Well, you'll need something that you can key off of in the request to distinguish the two "sites", but no it doesn't have to be the host name. That can be simplest though.

Without having different names, you'd have to vary the IP address (unlikely this is justification enough for a second address), or the port (can you tell the second site to use something non-standard?) or start using parts of the request portion of the URL.

The URL approach could work if you were to subdivide your sites by the top level URL (e.g., http://x.y.z.w/site1/… and http://x.y.z.w/site2/…), either by rewriting to a new location, or proxying to alternate servers. It can be tricky when retrofitting (as here) since you're already using the top level for one site, but as long as the prefix is not going to interfere with your first site, it should be fine. Though unless both sites have a prefix (and thus the root can be handled specially), the site without the prefix can accidentally be returned if a client for the other site leaves their prefix off a request.

It looks like your site(s) are basically static, so doing it in one server should be fine. But if you have more dynamic sites or applications already configured to be at the root of a URL, a way you can handle it is to have each site configured on a non-standard port (but only on localhost). This can be in a distinct web server instance or the same main server. Then have the main web server instance handle the public address URLs, and proxy to the appropriate internal port, with the usual URL rewriting across the proxy call. That keeps each application separate and lets them exist at the root of their own URL hierarchy.

-- David

Weird, I did not get the notification with your reply.

I got a bit lost with your explanation :( but thank you.

Anyways, what I did is adding an alias as follows

 <virtualhost 178.79.177.xx:80="">DocumentRoot /srv/www/
     Alias /wiki /srv/www/
     ErrorLog /srv/www/
     CustomLog /srv/www/ combined</virtualhost> 


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct