The configuration file of my virtual host has been written, and the hosts file has been modified. It was OK at first. Then I did a test and commented out the binding statement in hosts, and then the virtual host could no longer be accessed. But after I removed the comment, the virtual host is still inaccessible! How is this going?
First of all, I don’t know what tests you have done. In theory, commenting or not commenting things in hosts has no effect on whether the virtual host is running, it just determines whether you can access it. If you did not change apache's config and v-host when testing, it means that it is very likely that the first time you ran it was incorrect. My suggestion is that after confirming that v-host is correct, pay attention to check whether all the apache configs are enabled to allow rewriting, and whether the v-host file is correctly introduced. I remember that there is a tutorial on this configuration on the Apache official website, the address is http://httpd.apache.org/docs/2.2/vhos..., the v-host here should be correct.
Finally, let me share my own fucking experience. I configured it for a day and a half because there were many IPs required for virtualization at the same time.