When VirtualHostX first launched in 2007, the app's primary purpose was to help web developers and designers test their websites locally on their Mac. But with the demise of macOS Server's feature-set in recent years, lots and lots of folks are looking for a new, simple way to run websites on Mac - including many of VHX's customers. I've replied to lots of emails on the topic over the years, but this FAQ contains all the best practices I recommend.
If you're new to VirtualHostX, the first thing you'll want to do is get the app installed and create your first website. We have an illustrated Getting Started guide available here.
Once you've verified that your website is working locally for you on your Mac, you'll want to follow these steps to configure it and allow access from the internet. (These steps may vary depending on your exact setup / requirements. Feel free to get in touch if you have questions.)
By default, every website you create in VirtualHostX is given a URL like
http://something.vhx.cloud. That's the URL you use locally on your Mac for testing purposes. Other people on the internet won't be able to access your website with that URL because the
vhx.cloud domain name isn't real - it only works on your Mac. So, you'll need to buy a real domain name and point it to your Mac's public IP address. In general, the steps to do that are...
If your Mac is hosted in a data center or has a direct connection to the internet (not behind a firewall, proxy, router, etc) then at this point you probably already know what you're doing and are good to go.
However, if your Mac is hosted at home or in your office, behind a router / firewall / etc, then you'll need to allow traffic to your Mac's local IP address on TCP port 80.
Opening up access in your router / firewall varies depending on your network configuration and what type of router / modem / switch is between you and the internet. Ask your IT person or your newphew that builds apps for advice.
Note: By default, VirtualHostX's web server listens on port 8080. This is both for security reasons and also to prevent conflicts with any other old web servers you might have running on your Mac. What this means for you is, when you open up port 80 on your network's firewall / router, you'll need to route that traffic to your Mac's local IP address at port 8080. However, if you used VHX's "Bind to Ports 80 and 443..." command to make your web server run using the standard port numbers (80 and 443), then you don't need to worry about using port 8080. Just point the traffic to your Mac to port 80 like normal.
If you want your website to be served over a secure HTTPS connection (which you should!), then you'll need to take additional steps.
First, in addition to opening up port 80 as described in the previous section, you'll also need to allow traffic on port 443 to your Mac's local IP address and then use the "Bind to Ports 80 and 443..." command under VHX's "Web Server" menu.
Next, you need to acquire and install an SSL certificate. In order for this to work, your SSL certificate must be trusted by all the major web browsers, otherwise your visitors will get a scary warning and be blocked from visiting your website. And the only way to gain the trust of the web browser vendors is to have your certificate signed by a certificate authority. Traditonally, getting a signed certificate costs around $100 / year. If you have a valid cert already, VirtualHostX can install it for you.
Luckily, in recent years, a new non-profit called Let's Encrypt has begun issuing free SSL certificates that are trusted by all web browsers. You can generate and use a certificate issued by them and import it into VHX.
Even better, beginning January 2020, VirtualHostX Pro will be able to integrate directly with Let's Encrypt and create a trusted SSL certificate for you. This FAQ will be updated with instructions when that feature becomes available.