I have a server environment within a network that sits behind a dynamic IP. I as well have a virtual host online where I run Apache 2.4 with a couple of VirtualHosts.

Is it possible to create a VirtualHost (essentially a subdomain) linking to the dynamic IP mentioned above? I guess I have to change the A Record of the DNS settings, right? Is that possible at all?

  • 1
    Your question is badly formulated (the answer is "yes"), I suggest you follow this guide instead of trying to setup your own service (which will require running your own DNS server on two public IP-s in different networks & lots of stuff to code): wiki.archlinux.org/index.php/Dynamic_DNS – Anubioz Dec 10 '15 at 5:27

Yes, it is possible to set ServerName in Apache httpd to a DNS name, which A record will change.

If the public IP is configured directly on the server's interface (ie. not on a router in front of it), just remember to bind httpd to the catch-all address (, not to the domain name, or, even worse, current IP - this will require server restarts on IP change in the former case, or even configuration change in the latter.

But, given how cheap are some VPS plans today (and there're even some free ones available), isn't it more reasonable to use a dedicated service with a static IP?

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.