You are not logged in.

#1 2009-04-09 18:49:47

MindTooth
Member
From: Norway
Registered: 2008-11-11
Posts: 331

Need some help with Apache vhost. Access a server on network.

Not sure if this can be done. But here is my case:

Me and my colleague is writing some database applications for out employer. And this server runs Apache, PHP and MySQL.
We want to be able to access different vhosts using just the post after the server local IP-address. (I.e., 10.0.2.242:8080).
Because we want to use the same server for different projects, but we need some way to split this. And so far, a port name is the best.

Another way would be to use the DNS server, and redirect any request for example.com to that particular server. but since we have started to use OpenDNS, that can't be done.

My question is, can't this be achived? If I type 10.0.2.242:8080, i can be directed to /srv/http/test_vhost, where /srv/http is the server root.

Any reply is much apprecited. Since I could find an answear on Google.

Birger smile

Offline

#2 2009-04-15 07:19:26

MindTooth
Member
From: Norway
Registered: 2008-11-11
Posts: 331

Re: Need some help with Apache vhost. Access a server on network.

Isn't there anyone with a tine soluton to my problem?

Birger smile

Offline

#3 2009-04-15 08:36:41

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

Re: Need some help with Apache vhost. Access a server on network.

I don't know of a way to do this, but I see 2 solutions:
1) Create some virtual IP addresses on the server and access via the different IP addresses.
2) Named virtual hosts aren't that difficult. You can even add static entries to your hosts file to avoid having to setup your own DNS server:

dev-site1.server.local    10.0.2.242
dev-site2.server.local    10.0.2.243
dev-site3.server.local    10.0.2.244
dev-site4.server.local    10.0.2.245
etc...

(btw, OpenDNS is baaad.)

Offline

#4 2009-04-15 13:42:46

MindTooth
Member
From: Norway
Registered: 2008-11-11
Posts: 331

Re: Need some help with Apache vhost. Access a server on network.

Since I am not that techy, how can this be done? I want different ports to the devider. Not IP addresses, since I have only one IP for the server.

I run Windows at work. But I think I know to set a hosts different. But then I am not sure how apache is configed.

(OpenDNS sucks because? Better then the DNS server located inhouse. It is slooooow. OpenDNS is faster.)

Birger smile

Offline

#5 2009-04-15 16:51:12

bushmannt
Member
From: Charlston, SC
Registered: 2008-08-07
Posts: 7
Website

Re: Need some help with Apache vhost. Access a server on network.

sounds like you need a port based virtual host.  all you need for that is a Listen directive with a 1.2.3.4:80  per vhost configuration, pointing you to a different DocumentRoot.  here's the docs:
http://httpd.apache.org/docs/2.2/vhosts/examples.html

look under the section called Running different sites on different ports

Offline

#6 2009-04-15 19:42:14

MindTooth
Member
From: Norway
Registered: 2008-11-11
Posts: 331

Re: Need some help with Apache vhost. Access a server on network.

I have tryed it. But when I added :8080 behind the IP, it would not direct to the correct folder.
(One quested, must I select another folder then one level inside the root folder. Or can I select whichever folder I choose to?)

Goind to post my httpd.conf and httpd-vhosts.conf file tomorrow. Since the server is located at work.

Thank you for the help so far big_smile

Birger smile

Offline

#7 2009-04-15 22:45:53

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

Re: Need some help with Apache vhost. Access a server on network.

MindTooth wrote:

I run Windows at work. But I think I know to set a hosts different.

IIRC, C:\Windows\System32\drivers\etc\hosts

MindTooth wrote:

(OpenDNS sucks because? Better then the DNS server located inhouse. It is slooooow. OpenDNS is faster.)

It can screw you up because it *always* returns an IP address, which isn't so bad for web browsing, but when you're trying to do (or diagnose!) other things it can really screw with you.

MindTooth wrote:

I have tryed it. But when I added :8080 behind the IP, it would not direct to the correct folder.

Have you uncommented this line in httpd.conf?

#Include conf/extra/httpd-vhosts.conf

Offline

#8 2009-04-16 09:44:56

MindTooth
Member
From: Norway
Registered: 2008-11-11
Posts: 331

Re: Need some help with Apache vhost. Access a server on network.

Haha! I had forgot to include the vhost conf file. Thank you so much!! big_smile

Birger smile

Offline

Board footer

Powered by FluxBB