You are not logged in.

#1 2009-09-20 18:16:11

johnpatcher
Member
Registered: 2009-08-23
Posts: 70

vHosts without a domain?

Hi,

I'm wondering whether it is possible to set up some vhosts without a domain, just with the ip my server has?

My httpd-vhosts.conf is looking as follows:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName 188.xxx.xxx.xxx:80
</VirtualHost>

<VirtualHost *:80>
    ServerName vhost
    DocumentRoot "/srv/http"
    ErrorLog "/var/log/httpd/vhost-error_log"
    CustomLog "/var/log/httpd/vhost-access_log" common
</VirtualHost>

Unfortunately I only reach the webserver with http://188.xxx.xxx.xxx/, but not with http://vhost.188.xxx.xxx.xxx/. I'm wondering whether this is an error in my configuration or if this isn't possible at all?

Best regards
johnpatcher

Offline

#2 2009-09-20 22:56:10

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,223
Website

Re: vHosts without a domain?

johnpatcher wrote:

Unfortunately I only reach the webserver with http://188.xxx.xxx.xxx/, but not with http://vhost.188.xxx.xxx.xxx/. I'm wondering whether this is an error in my configuration or if this isn't possible at all?

That isn't possible. You're mixing a domain name with an IP address which just doesn't work.

If it's only for local access/testing, then you can add 'vhost' to your /etc/hosts file to point to 188.xxx.xxx.xxx and then access it just by opening http://vhost

Offline

#3 2009-09-27 18:06:47

briest
Member
From: Katowice, PL
Registered: 2006-05-04
Posts: 468

Re: vHosts without a domain?

johnpatcher wrote:
<VirtualHost *:80>
    ServerName vhost
    DocumentRoot "/srv/http"
    ErrorLog "/var/log/httpd/vhost-error_log"
    CustomLog "/var/log/httpd/vhost-access_log" common
</VirtualHost>

Unfortunately I only reach the webserver with http://188.xxx.xxx.xxx/, but not with http://vhost.188.xxx.xxx.xxx/

Have you considered using vhost.188.xxx.xxx.xxx as a ServerName instead of just vhost?

Offline

#4 2009-09-27 22:45:15

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,223
Website

Re: vHosts without a domain?

briest wrote:

Have you considered using vhost.188.xxx.xxx.xxx as a ServerName instead of just vhost?

It won't work. You can't mix domains/hostnames with IP addresses. The client won't know what to do with it.

Offline

#5 2009-09-28 18:04:33

crankyadmin
Member
Registered: 2009-09-27
Posts: 117
Website

Re: vHosts without a domain?

Virtual Hosts need DNS to work as it takes it as a varible from the intial GET request. I think it works if you use /etc/hosts

virthost1.foobar.com 11.22.33.44
virthost2.foobar.com 11.22.33.44

notice that both ip addresses are the same.


:: Github :: My AUR :: Coreboot ::

Offline

#6 2009-09-28 22:23:18

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,223
Website

Re: vHosts without a domain?

crankyadmin -> yes, that will work, but only any good if the OP is doing local testing, not a public website smile

Offline

#7 2009-09-28 22:26:06

crankyadmin
Member
Registered: 2009-09-27
Posts: 117
Website

Re: vHosts without a domain?

fukawi2 wrote:

crankyadmin -> yes, that will work, but only any good if the OP is doing local testing, not a public website smile

He wants to do it on a public website.... why does it not have dns?

/me goes and drinks more beer!


:: Github :: My AUR :: Coreboot ::

Offline

#8 2009-09-28 22:48:46

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,223
Website

Re: vHosts without a domain?

crankyadmin wrote:

He wants to do it on a public website.... why does it not have dns?

Home DSL connection?

crankyadmin wrote:

/me goes and drinks more beer!

Not fair. I only just started work sad

Offline

#9 2009-10-04 01:18:16

johnpatcher
Member
Registered: 2009-08-23
Posts: 70

Re: vHosts without a domain?

Ok, I have DNS working right now, and it works just fine.

Just wondered whether it would also work without, because it took me a while to register and set up this whole domain stuff.

Offline

#10 2009-10-04 07:20:07

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,223
Website

Re: vHosts without a domain?

johnpatcher wrote:

Just wondered whether it would also work without, because it took me a while to register and set up this whole domain stuff.

Without... what? hmm

Offline

Board footer

Powered by FluxBB