Search code examples
apachecurldnswebserverip-address

Access IP address website as if accessed via a domain name


I've configured Apache on a web server so that different domains show different websites.

While I wait for the DNS updates that will point my domain at this servers IP address, I'd like to test if my website is running correctly.

Is there a way I can access a website via it's IP address, but do something in the client so as to tell the Apache server I've accessed it via a domain I specify?


Solution

  • It treats the config files in a top-down approach. It will default to the first vhost based upon alpahbet (if no numbers are present), or the lowest number config file.

    For example:

    000-default.conf
    test.com.conf
    site-a.com.conf
    site-b.com.conf
    

    In the above, 000-default will be the default, because it goes “numbers, then letters”.

    To see which one is being used:

    apache2ctl -S
    

    So you can basically rename and check.