seo – Remove the indexed IP address from Google

I developed my website under / var / www / html (for the development part) so you can check the website when you enter the IP address of the server in my web browser. On the same server I have the same products under /var/www/example.com And it is this domain that I want to index in Google.

My problem is that Google has indexed both. Sometimes, products appear on Google with example.com and, sometimes, Google shows the server's IP address.

So I added meta robots noindex nofollow, and also do not allow: / in robot.txt to remove the version of the site's IP address from the Google search console. However, the IP address still appeared on Google. So I decided to completely delete all the files in / var / www / html and left only the nginx html page. However, I still have the same problem. The IP address is always displayed in Google. I noticed that the meta description is ignored too. Google takes the previous description.

Can you tell me if I did something wrong or what should I do to remove this IP from Google search? How long do we have to wait to see the changes?