Solved

Virtualhost forwarding to _another_ domain not hosted

Posted on 2004-10-05
10
578 Views
Last Modified: 2011-09-20
Hi all,

I run a member server of the great project http://www.pool.ntp.org/  - and following on from their request, I need a permanent redirect virtualhost directive (please visit URL to see the request).

Basically, my domain is static IP.  In the 'pool' dns of the ntp servers, my IP points to uk.pool.ntp.org specifically for ntp.conf to use.

The idea is, if anybody decides to look up via browser uk.pool.ntp.org and the 'random' dns rotation is pointing to me at exact time, it will redirect to www.pool.ntp.org instead of _my_ home page/site.

Buggered if I can solve this one.

TIA,

Nick
0
Comment
Question by:Nick
  • 5
  • 4
10 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 12233232
You mean  uk.pool.ntp.org  -->  www.pool.ntp.org

The easy way to do it is to make uk.pool.ntp.org   as a DNS CNAME of www.pool.ntp.org

if you are looking after www.pool.ntp.org, you can make uk.pool.ntp.org  as a virual host
use the same Document Root as www.pool.ntp.org.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12236240
If I understand correctly, you maintain the time server for uk.pool.ntp.org on your server, but not the web page, which should simply forward to a different server, which is located at www.pool.ntp.org ... correct?

Yuzh's answer would be correct if you maintained the root dns and web servers for www.pool.ntp.org, but your situation is a little different.

In your httpd.conf, set up the following virtualhost (or the equivalent, if you use

<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName uk.pool.ntp.org
Redirect Permanent / http://www.pool.ntp.org
</VirtualHost>

where xxx.xxx.xxx.xxx is your IP address for uk.pool.ntp.org
0
 
LVL 1

Author Comment

by:Nick
ID: 12236345
OK, I don't run a DNS server - my domain is held on my ISP servers, and all the pool.ntp.org is run by them guys.

Periwinkle, that works, but I have already been down this route - it forwards ALL requests to www.pool.ntp.org...

I want requests that come in on my domain for the server to serve them as normal... but if somebody uses uk.pool.ntp.org/pool.ntp.org (which will be same IP as my domain), then that, and only that will be redirected to www.pool.ntp.org

Nick
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 15

Expert Comment

by:periwinkle
ID: 12236426
You need TWO virtual host setups;  the one for all requests, and the one for uk.pool.ntp.org:

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

(your normal setup)

</VirtualHost>

<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName uk.pool.ntp.org
Redirect Permanent / http://www.pool.ntp.org
</VirtualHost>
0
 
LVL 1

Author Comment

by:Nick
ID: 12236529
OK, that is serving my domain up OK... I will have to wait until the DNS rotation on pool.ntp.org servers includes my IP until I can test uk.pool.ntp.org.

httpd gives me a warning too, with this set up:

"[Wed Oct  6 12:51:34 2004] [warn] VirtualHost xxx.xxx.xxx.xxx:80 overlaps with VirtualHost xxx.xxx.xxx.xxx:80, the first has precedence, perhaps you need a NameVirtualHost directive."

Is this OK?  To me it reads the second virtual server will be ignored?

Nick
0
 
LVL 15

Accepted Solution

by:
periwinkle earned 500 total points
ID: 12236632
Ah, yes, - you need to have:

NameVirtualHost xxx.xxx.xxx.xxx:80

and

Listen 80

outside of the VirtualHost directives in httpd.conf.  That tells it that you are using multiple sites for the IP address.
0
 
LVL 1

Author Comment

by:Nick
ID: 12236701
OK, if I use the 'Listen' directive, httpd doesn't start - no errors messages or anything!

But using the NameVirtualHost httpd starts clean.

I will wait and see now if it works.  I will revisit after I can test.

Thanks,

Nick
0
 
LVL 1

Author Comment

by:Nick
ID: 12236923
Thanks, works perfectly.

I nearly had this, but I defined main server with the VirtualHost _default_:* directive - and that I couldn't get to work.

Thanks,

Nick
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12237006
Nick -

Delighted to be of assistance - let us know that all went well when uk.pool.ntp.org resolves to your IP address!
0
 
LVL 1

Author Comment

by:Nick
ID: 12237067
It does, thats how I tested.  But I was a bit stuck on how to fool the DNS rotation to get it to select my IP  (do a # dig uk.pool.ntp.org  you will see what I mean)... so I stuck my 'IP   uk.pool.ntp.org' into hosts file and then visited uk.pool.ntp.org.  My httpd comonvhost logs show the redirect.

So it works.

Nick
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Stop people from trying to get into my server 8 125
new line in php on linux server 6 191
How can I install php on a ngxin server on droplet 5 136
Domino Website - Redirection 12 76
Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question