The default Virtual Box machine network settings are shown below.
Try changing the settings to what is shown below.
This should cause your virtual machine to use the same DHCP and DNS as your physical machines. Basically, your virtual machine will be on the same LAN as your physical machines.
A simple working configuration starting with the default macOS Apache config files is the following:
/etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
127.0.0.1 foo.localhost
127.0.0.1 bar.localhost
255.255.255.255 broadcasthost
::1 localhost
Modifications of the default /private/etc/apache2/httpd.conf file:
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
...
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php7_module libexec/apache2/libphp7.so
...
DocumentRoot "/Users/<username>/Sites"
<Directory "/Users/<username>/Sites">
...
Include /private/etc/apache2/extra/httpd-vhosts.conf
Virtual hosts configuration /etc/apache2/extra/https-vhosts.conf
#Enable PHP interpretation within HTML files
<FilesMatch ".+\.html$">
SetHandler application/x-httpd-php
</FilesMatch>
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Users/<username>/Sites
</VirtualHost>
#VIRTUAL HOST ENTRY FOR foo.localhost
<VirtualHost *:80>
DocumentRoot "/Users/<username>/Sites/foo"
ServerName foo.localhost
ErrorLog "/private/var/log/apache2/foo-error_log"
CustomLog "/private/var/log/apache2/foo-access_log" common
</VirtualHost>
#VIRTUAL HOST ENTRY FOR bar.localhost
<VirtualHost *:80>
DocumentRoot "/Users/<username>/Sites/bar"
ServerName bar.localhost
ErrorLog "/private/var/log/apache2/bar-error_log"
CustomLog "/private/var/log/apache2/bar-access_log" common
</VirtualHost>
PHP test file index.html in foo/ and bar/:
<html><body><h1>Welcome to foo/bar. It works!</h1></body></html>
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
Enabling userdir stuff isn't required because you don't want to access .../~username/
Then in Safari or Google enter "http://bar|foo.localhost" instead of simply "bar|foo.localhost"
This configuration shouldn't/won't allow access to http://localhost or http://localhost/~username. But in your case this is not required anyway.
If access to http://localhost and http://localhost/~username1|~username2|~username3 etc is required, use the default DocumentRoot /Library/Websites/Documents
in httpd.conf and for the vhost localhost. Additionally enable LoadModule userdir_module libexec/apache2/mod_userdir.so
and Include /private/etc/apache2/extra/httpd-userdir.conf
in httpd.conf. Enable Include /private/etc/apache2/users/*.conf
in /private/etc/apache2/extra/httpd-userdir.conf and add respective <username1|2|3>.conf files in /private/etc/apache2/users/ for each user.
Best Answer
From Macrumors (in the Mojave 'All the little things' thread):
Time sync: ntpd has been replaced by timed: not the old school unix one, but a new apple invention.
Have linked the timed Man page for ya:
https://www.unix.com/man-page/mojave/8/timed/