How to point different domains to different folders?

January 22, 2017 777 views
Apache Configuration Management Ubuntu

I setup a domain name (bileaf.com) in the DO droplet. I then installed Vesta CP and provided the domain information whenever it asked. When I opened my domain name on the browser it showed me a panel welcome page (not the actual panel admin login but a panel html page saying powered by vesta).

Now, I added two more domains to my DO and now want to point them to different folders. I went through https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts article to setup Apache virtual hosts. But, now whenever I try to go to any of these domains on my browsers it keeps going to the panel page for my first domain.

I dug around a bit and it seems like the panel page is in /home/admin/web/panel.bileaf.com/public_html. Both of the secondly added domains are pointing to this.

Any idea what I am doing wrong and how can I fix this?

Thanks.

2 Answers

@anuragsharma

From what I've read about VestaCP, they recommend against directly modifying Apache config. This is most likely because any changes you make directly will be overwritten by VestaCP the next time that you create a domain or sub-domain, or make any changes that cause changes to be made to Apache config.

That being said, VestaCP uses /home for each user. So if you added these domains using the default admin user, your base directory would be /home/admin and each of your domains main directories would be located in /home/admin/web.

For example, if you created domain01.com and domain02.com, then their directories would be:

/home/admin/web/domain01.com

and

/home/admin/web/domain02.com

and their public_html folders would be:

/home/admin/web/domain01.com/public_html

and

/home/admin/web/domain02.com/public_html

Within each of the publichtml directories, there's an index.html file which is copied over from the main directory. That's why you're seeing the Powered By VestaCP when you visit your domains. You need to delete or replace this file and upload your websites files to the publichtml directories.

  • Hmmmm. OK removed VestaCP as per the instructions on their website. But, my other domains are still pointing to powered by vesta pages. Is there something that's setting the default redirection to the /home/admin/web folder?

@anuragsharma

You don't need to remove VestaCP if you need a control panel to manage your domains. Without a CP, you'd need to manually install a LAMP or LNMP stack and do what the CP would do by hand.

That being said, removing VestaCP won't delete your existing users and domains, so they will still be pointing to the directories they were set to when VestaCP was installed.

VestaCP wasn't redirecting your domains. It creates a directory for each user and each domain that you create through the control panel. Each domain that is created is given an index.html file, so it's not redirecting your domains to a central index.html, it's simply pulling up the index.html file that resides in each domains' public_html directory.

If you substitute your domains in place of domain01 and domain02 above, you'll see where the index files are.

Have another answer? Share your knowledge.