Set Default Website For Apache2 if IP address is typed

I want my one of my websites in the virtualhosts configured apache2 (LAMP) droplet. So if anyone types x.x.x.x IP in their browser this ‘default’ website is displayed.

How can one configure this behavior?

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.

Site Moderator
Site Moderator badge
September 10, 2020
Pinned Answer

Hi all,

In Ubuntu, if you want to make A website load when the droplet’s IP address is loaded in your browser https://XXX.XXX.XXX.XXX there are a couple of steps that need to be followed.

The change you need to implement is to your default configuration file. This file can be found in directory - /etc/apache2/sites-enabled/

Once you are in there, open the file 000-default.conf. In it, find the line that says

DocumentRoot /var/www/html

And change it to your domain’s root directory.

Let’s say your domain is Usually, your DocumentRoot is configured to be in /var/www/ or /var/www/html/ Set the DocumentRoot to the path. If you are uncertain about the DocumentRoot, you can check it from your domain’s configuration file again found in /etc/apache2/sites-enabled/.

Once the change has been done to /etc/apache2/sites-enabled/000-default.conf don’t forget to restart apache

service apache2 restart

Regards, KFSys

I have the same problem and the solution is: config your default site in 000-default.conf, and enable it, restart the apache2. Then the default site will be opened if you typed the IP address.

In your file “/etc/httpd/conf/httpd.conf” add a virtualhost and setup a landing page in your directory “/var/www/html/defaultsite”

NameVirtualHost :80 <VirtualHost default:> DocumentRoot /var/www/html/defaultsite </VirtualHost>

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel