Your first site
Open Sites → Virtual Hosts and press New. The form opens in a dialog over the list; it is short, and every field maps to one line of the Apache block it will write. Esc or a click outside the dialog closes it without saving.
ServerName
The domain you want to type in the browser. Leave off the suffix and Vhostly adds .test
for you, so myapp becomes myapp.test. Anything containing a dot is taken as-is.
.test is reserved for exactly this purpose and will never be a real TLD — see
virtual hosts for why the suffix matters more than
it looks.
Type
Static serves a folder. Pick the directory Apache should serve — the one with
index.php in it, or public/ for a Laravel or Symfony layout. Browse opens a Finder
picker if you would rather not type the path.
Proxy forwards to a port on localhost. Give it the port your dev server is already running on and Apache passes everything through, WebSockets included. See proxy sites.
You can switch a site between the two later by editing it.
LogLevel
Apache's verbosity for this site alone, from debug through crit. warn is the default
and is almost always what you want; raise it to debug while chasing a rewrite rule and
put it back afterwards.
Enable HTTPS
A checkbox on new sites. It is ticked by default once your local certificate authority is trusted. Before that it is left to you, because the first time costs a macOS password prompt.
You do not need to set anything up first. On the first site with HTTPS, Vhostly installs mkcert if it is missing and trusts its local authority, then issues the certificate. After that, HTTPS on a new site takes no prompts at all.
Ticking it issues a certificate, enables mod_ssl, adds Listen 443, and writes a second
<VirtualHost *:443> block for the site. All of that is one action; see
HTTPS and certificates.
What Add actually does
Pressing Add runs this, in order:
- Snapshots the current vhosts files into backups.
- Appends a
<VirtualHost *:80>block tohttpd-vhosts.conf. - Adds the hostname to
/etc/hosts, on both the127.0.0.1and the::1line. - Enables HTTPS for the site, if you asked for it.
- Restarts Apache.
Then open http://myapp.test — or https://myapp.test if you enabled HTTPS. There is no
port in the URL because Apache is already on 80 and 443.
Switching a site off
The toggle on each row moves the vhost block into httpd-vhosts.conf.disabled, removes the
hosts entry and restarts Apache. The block is kept verbatim, so switching back on restores
exactly what you had. A disabled site cannot be opened, and the row says so.
Deleting is the permanent version of the same thing: the block goes from both files, the hosts entry goes, Apache restarts. The backup taken beforehand is your undo.