How do i set which apache virtual host will my ip go to

I follow this step How To Set Up Apache Virtual Hosts on Ubuntu 16.04

when i type it’s show when i type it’s show when i type my server ip it’s show

my problem is i want to set my server ip to show or not show anything. where can i set it.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Default virtual host will be the first loaded one. If you have multiple virtual hosts in same file, first from file will be default. If you have them in multiple files, VHost in first file will be default.

File are sorted alphabetical, with files starting with digit having highest priority:


So let’s say you have enabled following hosts (you can see enabled hosts using ls -l /etc/apache2/sites-enabled):

Sample Output

You want to be default but it isn’t. Disable it using a2dissite:

  1. sudo a2dissite

Now rename it so it comes before

  1. sudo mv /etc/apache2/sites-available/ /etc/apache2/sites-available/

Enable it once again and restart Apache:

  1. sudo a2ensite
  2. sudo systemctl restart apache2

Try to visit site via IP, it should be working correctly this time.