Second virtual host (can't find redirect)

I have set up a second virtual host on a LAMP stack droplet from Digital Ocean.

I have changed the /etc/apache2/sites-available/ to my new domain.

My DNS records: A to IP, A to IP with www, AAAA to IP, AAAA to IP with www, 3 ns to Digital Ocean. I have pointed the DNS to digital Ocean from Namecheap.

Weird thing is when entering the domain it gets redirected to my first site on this droplet. It tries to connect and write the domain in the browser. I can’t find from where. A site I have deleted a long time ago. I have deleted it in /etc/apache2/sites-available/

My /etc/hosts: localhost username

Any help to figur how I get the new virtual host to point to the correct site will be greatly appreciated, thanks!

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
April 7, 2021
Accepted Answer

Hi @artctrldelinfob0d23996f849,

It seems to me like the source of the issue is coming from your Apache virtual config file. Can you please provide me with your config file(the new one that you said you’ve created) so that I can see everything is configured properly?

What I believe most probably the issue to be is a left reference to the old domain somewhere in the config file.

Additionally, did you try to enable the config file? What you need to do is :

sudo a2ensite

Once done, you also need to restart apache

sudo systemctl restart apache2

One last thing, if everything seems okay but you still experience the issue, I’ll recommend just creating a new config file without copying anything over.

You can use this for reference:

sudo nano /etc/apache2/sites-available/

then inside add the following

<VirtualHost *:80>
    DocumentRoot /var/www/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
sudo a2ensite
sudo systemctl restart apache2

and that should be it.

Regards, KFSys

I have memcached my droplet and all the sudden it worked. I wanna say BIG thank you for your help, it means A LOT!!!

Thanks my good person, you rock!

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