The solution of unable to access the website built by the virtual machine locally
First of all, ping the ip address of the virtual machine, and you can't communicate with ping, which is caused by not being in the same network segment.
At this point, you only need to automatically obtain the ip address in the virtual machine, so that the virtual machine and the machine are in the same network segment, and the website can be accessed normally.