This is assuming the local Apache instance is only listening on localhost, eg 127.0.0.1
, otherwise just access it using the machine's IP on the network.
You can use a SSH tunnel.
You can use the -L [bind_address:]port:host:hostport
paramater to creat tunnels. See: man ssh
Lets say your local mac has the ip address of 192.168.1.10
and the other mac has the ip address of 192.168.1.11
and the local Apache instance is running on port 80
you could use something along the lines of: ssh -L 10080:127.0.0.1:80 user@192.168.1.10
from the other mac.
This can get confusing but essentially 10080
represents a port created on the other mac (this is can be any free port number, need to be admin to be a lower port number), and 127.0.0.1:80
represents what will be forwarded to the other mac from 192.168.1.10
's perspective.
To browse the website hosted on your mac, from the other mac, navigate to http://127.0.0.1:10080
.
Please let me know if you need any additional clarification.