I have a single Digital Ocean droplet with 5 websites hosted on it via virtualhost. Everything works fine. Their domain names point to each one individually. Using Ubuntu 14.04 and Apache.
I want to add a sixth "test" site, without a domain name pointing to it. I want to use it to test out some WordPress stuff. The physical location of the home page to this site is:
/var/www/test_site/html/index.html
Let's say my server's IP address is 198.51.100.55
What do I need to do to make this home page available to anyone on the internet as follows?
http://198.51.100.55/test_site/html/index.html
Summary: You cannot make it work for everybody unless you use a domain name. But if you just treat
198.51.100.55
as if it was yet another domain name, it will work for most users - at least for the time being.My recommendation is to create a domain for your test site. Possible options include: acquiring a new domain, using a subdomain of one of your existing domains, using a free subdomain from one of the various providers of such domains.
The URL
http://198.51.100.55/test_site/html/index.html
will never be accessible to the entire internet.There are new networks being deployed without IPv4. In order to allow clients on such networks to access IPv4-only resources techniques such as DNS64 and NAT64 are being used. If the name of your server was
test.example.com
the connection flow for such a client could work as follows:test.example.com
example.com
for the AAAA record fortest.example.com
example.com
for the A record fortest.example.com
198.51.100.55
2001:db8:c481:4960:88df:da01::/96
and the IPv4 address. The result is2001:db8:c481:4960:88df:da01:198.51.100.55
AKA2001:db8:c481:4960:88df:da01:c633:6437
.test.example.com
is2001:db8:c481:4960:88df:da01:c633:6437
.2001:db8:c481:4960:88df:da01:c633:6437
.But the moment you try to do this with an IP address rather than a domain name, it breaks down. The browser will never send any DNS request, so it never learns that
198.51.100.55
is to be substituted by2001:db8:c481:4960:88df:da01:c633:6437
. Instead the browser will try to connect to198.51.100.55
, but the host has no IPv4 route, so the kernel will tell the browser that the server is unreachable.The only way you can make the site available to users on such a network (without breaking anything else) is by having a domain name for your site.
If you are satisfied with making your site available only to a large percentage of the internet (which will keep getting smaller over time), then you can simply treat
198.51.100.55
as yet another domain name and configure a virtual host accordingly.It would look something like this:
Place the following before the other virtualhost definitions in your config file.
Then reload Apache.