How to enable multiple websites in apache on local virtual machine?

Posted by evolution800@reddit | linuxadmin | View on Reddit | 0 comments

I have debian 12 server virtual machine installed on virt-manager. I am trying to enable multiple websites on apache server and access them from my host machine typing something like this site1.local, but i can't make it work. On my host machine (mx linux) i edited the file /etc/hosts and added these lines:

192.168.122.114 site1.local
192.168.122.114 site2.local

Then i created virtual host files for apache on my debian virtual machine, but if i type site1.local in the browser on my host machine it won't connect to the server. I get server not found error.