Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a simple httpd.conf, which is working

<VirtualHost *>
    AddDefaultCharset UTF-8

    DocumentRoot "/opt/rt4/share/html"
    <Location />
        Order allow,deny
        Allow from all

        SetHandler modperl
        PerlResponseHandler Plack::Handler::Apache2
        PerlSetVar psgi_app /opt/rt4/sbin/rt-server
    </Location>
    <Perl>
        use Plack::Handler::Apache2;
        Plack::Handler::Apache2->preload("/opt/rt4/sbin/rt-server");
    </Perl>
</VirtualHost>

When I connect to MyDomain.dynamicDNSServer.TLD, I load my RT just fine.

But since I want it to be rt.MyDomain.dynamicDNSServer.TLD, I set it to exactly the same thing, except I make it

<VirtualHost rt.MyDomain.dynamicDNSServer.TLD>

and now when I restart Apache2, it says "No address associated with hostname: Could not resolve host name rt.MyDomain.dynamicDNSServer.TLD -- ignoring!"

How would I do that? I cannot assign it a static IP in hosts, since it will change whenever my router grabs a new IP.

share|improve this question
up vote 2 down vote accepted

First of all, be sure that you have a specific subdomain dyndns entry or a wildcard dyndns entry for your ip. This means that besides MyDomain.dynamicDNSServer.TLD also either *.MyDomain.dynamicDNSServer.TLD or at least rt.MyDomain.dynamicDNSServer.TLD have to resolve to your dynamic ip. If you have neither of these you cannot use a subdomain-specific apache configuration.

In apache, subdomains are specified by ServerName and not using the <VirtualHost> directive (see docs for further information).

The following should work for your subdomain:

<VirtualHost *>
    ServerName rt.MyDomain.dynamicDNSServer.TLD
    AddDefaultCharset UTF-8
    DocumentRoot "/opt/rt4/share/html"
    ...
</VirtualHost>
share|improve this answer
    
Still does not work, it still behaves the same way. Cannot access it via rt.MyDomain.dynamicDNSServer.TLD. Even with the servername directive in there, I can still access it via MyDomain.dynamicDNSServer.TLD – SinisterMJ Sep 4 '12 at 11:36
    
@AntonRoth You have to use a specific or wildcard dynamic dns entry (this has to be set up with your dyndns provider). Otherwise you can't use subdomain-specific apache configurations. I updated my answer accordingly. – speakr Sep 4 '12 at 12:01
    
Okay, thank you, I will take a look at this. – SinisterMJ Sep 4 '12 at 12:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .