# apache vhost problem , yes i read previous post already

## carbon

i have this

 * Stopping apache2...                                                                                                     [ ok ]

 * Starting apache2...

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

no listening sockets available, shutting down

Unable to open logs

here is my vhosts.conf

Listen 80

################# Named VirtualHosts

NameVirtualHost *

<VirtualHost *>

DocumentRoot /home/pig/http

ServerName www.chuhei.com

</VirtualHost>

----------

## devon

Isn't the "Listen 80" directive already in the main conf file? Like apache2.conf/httpd.conf/commonhttpd.conf.

----------

## carbon

yes, but i looked at documentation in apache.org

it has that in the example.

it starts ok without listen 80

but if i get to www.chuhei.com, it will say the website cant be reach or something.

----------

## devon

I don't get any errors.

```
$ host www.chuhei.com

www.chuhei.com has address 64.85.73.31

$ telnet www.chuhei.com 80

Trying 64.85.73.31...

Connected to www.chuhei.com.

Escape character is '^]'.

HEAD / HTTP/1.0

HTTP/1.1 200 OK

Date: Thu, 31 Jul 2003 03:54:46 GMT

Server: Apache/1.3.26 (Unix) PHP/4.2.3

X-Powered-By: PHP/4.2.3

Connection: close

Content-Type: text/html

Connection closed by foreign host.
```

Is that the right IP address?

----------

## carbon

www.chuhei.com should be pointing to kilikwala.homelinux.com

which is not the ip shown (64.85.xx.xx)

----------

## devon

Are you hosting the domain for a friend? You need to have the DNS records updated to point to the correct IP. 

FWIW, here is what I get for kilikwala.homelinux.com

```
$ host kilikwala.homelinux.com

kilikwala.homelinux.com has address 65.37.44.61

$ telnet 65.37.44.61 80

Trying 65.37.44.61...

telnet: Unable to connect to remote host: Connection refused
```

----------

## carbon

yes , he made www.chuhei.com points to kilikwala.homelinux.com

but if you ping www.chuhei.com, the ip that shows up is still different from kilikwala's

----------

## devon

 *Quote:*   

> yes , he made www.chuhei.com points to kilikwala.homelinux.com

 

How did he do this? Did he change the DNS record? Because it looks like he didn't.  :Smile:  Or is he using a HTTP redirect to redirect people?

----------

## carbon

i think he got www.chuhei.com from namezero or something

and thats like a free domain name which you can use the address as an alias to point to some other site.

----------

## carbon

now i go to www.chuhei.com

i got nothing show up, i mean really nothing, it's a blank screen.

under vhosts.conf

the documentroot has index.html , i checked

anyclue??

----------

## devon

What IP address do you get for www.chuhei.com? When I try to go to it, I get a blank screen also. Let's look at the HTML.... I see he has a frame for kilikwala.homelinux.com. But I when I try to go to that, I get Connection Refused. Do you have your port forwarding setup correctly on your firewall?

----------

## carbon

yes, port 80 is forwarded to my gentoo box which has apache listening to it.

in apache2.conf

ServerRoot /etc/apache2

ServerName kilikwala.homelinux.com

blah blah blah, the rest didnt changed

in vhosts.conf

NameVirtualHost *

<VirtualHost *>

DocumentRoot /blah/blah/blah/    which this has index.html

ServerName www.chuhei.com

<blah>

when you ping www.chuhei.com

the ip of it is not the same as kilikwala's, shouldnt they be the same??

----------

## devon

No I am getting a new error.  :Smile: 

"403 Forbidden -- You don't have permission to access / on this server.".

----------

## carbon

i had that problem, it was becoz apache wasnt in the users group, now it is not working again  :Mad:   :Mad:   :Mad: 

----------

## carbon

ok i figured something out

now the default page shows up for kilikwala's

within vhosts.conf

there is a vhost entry for both kilikwala and chuhei

which they have different document root

but i dont know why www.chuhei.com also gives me the default page  :Confused: 

----------

## devon

Because www.chuhei.com's HTML just uses your website in their frame. 

```
<frameset frameborder="0" framespacing="0" border="0" rows="100%,*">

    <frame name="TOPFRAME" src="http://kilikwala.homelinux.com"

           noresize>

    <noframes>

          <body>

           <h1>Welcome to CHUHEI.COM</h1>

           <br>

      chuhei<br>

      <br>

      Click here to enter <a href="http://kilikwala.homelinux.com">http://kilikwala.homelinux.com</a>

           <hr>

        </body>

    </noframes>

</frameset>
```

Can you point www.chuhei.com to the same IP address as kilikwala.homelinux.com?

----------

## carbon

my ip is dynamic, and kilikwala is only a DNS domain name

so how to make www.chuhei.com points to a changing ip??

----------

## devon

How often does your IP change? In order for name-based virtual hosts to work, the HTTP request has to ask for the correct domain. Since http://www.chuhei.com just uses a frame to request for http://kilikwala.homelinux.com, you will see the default site inside the frame.

Perhaps you can have his site in a subdirectory under your domain like http://kilikwala.homelinux.com/chuhei.

----------

## carbon

so what does he has to set chuhei.com to point to? i am thinking www.chuhei.com should continue to point to kilikwala.homelinx.com without changes.

"http://kilikwala.homelinux.com/chuhei" i dont understand how to make this happen. is that the servername under vhosts.conf?

DocumentRoot is /home/chuhei/http/ thats fine , right?

----------

## BxBoy

The way I do it is at the DNS level, I setup a CNAME for www.BxBoy.com that points to home.BxBoy.com and that got the vhost working. In the apache you would also have to setup individual vhost configurations in the httpd.conf file.

If you need detailed help, you can catch me on IM.

----------

