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
        use Plack::Handler::Apache2;

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.


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"
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.