Report this

What is the reason for this report?

Virtual Host Setup: Assign specific website to IP (default)

Posted on July 17, 2016
Eric

By Eric

I just setup my droplet as a virtual host (LAMP + Ubuntu) and successfully added 5 websites! win! However, it seems to have chosen one of the five as the default when I visit my IP address directly. Is there a way to specify which site inside of /var/www/ the IP should default to?



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!

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.
0

Accepted Answer

Look for the VirtualHost blocks in /etc/apache2/sites-enabled that you want to set as the default. Make the following change(s)

<VirtualHost  *:80>   or <VirtualHost *:443>

to

<VirtualHost _default_:80>   or  <VirtualHost _default_:443>

Make sure only one virtual host block is assigned the default (max one default per port). As you may already know, http URLs are usually assigned to port 80 and https URLs to port 443.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.