Forum Moderators: phranque

Message Too Old, No Replies

need virtualhost to listen on second ip but ip not in tag

virtualhost, ip

         

phazei

5:34 pm on Nov 12, 2010 (gmt 0)

10+ Year Member



We are running plesk, so the files are auto generated. Currently it looks like so:
<VirtualHost 216.#.#.123:80>

and I realize my final goal is basically:
<VirtualHost 216.#.#.123:80 192.#.#.123:80>

But I can't simply put it inside the httpd.include file or it will be lost if plesk reconfigures.
So I need to add the 192 ip somewhere else.

Inside of vhost.conf I attempted this:
<VirtualHost 192.#.#.110:80>
ProxyPreserveHost On
ProxyPass / http://site.com/
ProxyPassReverse / http://site.com/
ServerName site.com
</VirtualHost>

But I got the error:
"<VirtualHost> cannot occur within <VirtualHost> section"

Not sure how to go about this.

Thanks

sublime1

7:34 pm on Nov 12, 2010 (gmt 0)

10+ Year Member



@phazei --

It sounds like Plesk is generating the VirtualHost container and contents -- if so, adding your own VirtualHost directive inside is an error.

It's perfectly legitimate to have multiple virtual host containers, so


<VirtualHost abc:80>
Directive1
Directive2
</VirtualHost>

<VirtualHost def:80>
Directive1
Directive2
</VirtualHost>


Is ok. If you're really editing the vhost.conf file itself in Plesk you should be able to do this. Or maybe Plesk will let you add a second VirtualHost for the 192.x.x.x addresses.

However....

This format of Virtual Host is very old school. If your web host supports it (and probably does) chances are this is the simpler way to go. Read here: [httpd.apache.org...]

My guess is that you are trying to support the ability to test or use a server when it has a local (intranet) address as well as when it has a public address. I have done this a lot for test servers, for example.

The way we handled this at most of the companies I worked at was to have a DNS server in the office that would resolve the server name internally to the internal address (192.x.x.x) whereas people outside would get the normal public IP address.

Note that you have to be really (really) careful if you do this, as that externally accessible server is running on your local intranet, so is a potential security hole!

Anyway using named hosts, you just specify the domain (and subdomains) that the virtual host should match regardless of which address is used to get at the host.

Hope this gets you going in the right direction...

Tom

phazei

8:42 pm on Nov 15, 2010 (gmt 0)

10+ Year Member



Actually the purpose is for one server to get a RSS feed from another server. They are both on the same internal network, and both running their own sites. Issue is when server1 goes to site2.com/feed, it takes lots of bandwidth that counts against our limit. OTOH, if we went 192.x.x.123/feed, it wouldn't count towards our limit. It does cache it and only update once and hour, but one say something went wrong with writing the cache file, and it sucked up 25gigs+ a day in bandwidth since it was 250K pulled per page load, which added up quickly.

phazei

8:45 pm on Nov 15, 2010 (gmt 0)

10+ Year Member



Oh, and I was trying to set it up with that proxy, because I wanted the settings to be identical. If I just copied the virtualhost data for a second manual section, then it wouldn't dynamically change if I changed anything in plesk.

jdMorgan

11:07 pm on Nov 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That is the unfortunate side-effect of using Plesk --or any other "control panel"-- for this purpose.

It's likely that you will either need to "live with it" and re-modify your config each time after you use Plesk, or switch to a service grade that gives you full config access to do modifications manually (or using your own scripts), and does not require you to use Plesk or any other control panel.

Jim