# Apache: Port based virtual hosts

## Naughtyus

I posted in the Newbie section, but that seems to be sitting to waste with no responses, so I'm trying here.  :Smile: 

For my previous (debian) install of Apache, all I had to do was add the following lines to my httpd.conf: 

Listen 81 

<VirtualHost *:81> 

DocumentRoot /www/whatever 

</VirtualHost> 

--- 

No matter which conf file I add these lines to in my gentoo install though, I can't get port based virtual hosting to work.. Is there another step needed that I'm forgetting?

----------

## handsomepete

Perhaps the reason you didn't get any responses is that you're not asking anything.  What you've posted is just a statement of fact, so probably no one felt the need to respond.  Is what you posted not working for you now?  If not, does this work?

```
<VirtualHost *>

    DocumentRoot /www/whatever

    ServerName *:81

</VirtualHost>
```

I dunno.  I haven't tried it, but it seems reasonable to me.

----------

## Naughtyus

 *I wrote:*   

> No matter which conf file I add these lines to in my gentoo install though, I can't get port based virtual hosting to work.. Is there another step needed that I'm forgetting?

 

 :Wink:  I'll try that, thanks.

----------

## handsomepete

 :Embarassed:   I've just gotten in the habit of considering anything beneath a couple dashes as a .sig so I must've just ignored that.  Please forgive my stupidity.

----------

