Question

Adding another domain to a single domain apache server

Hi all.

I am kinda new to Centos and Apache (and LAMP). My server is running Centos 7 and has only 1 domain currently in /var/www/html (whith joomla CMS).

I need to add a new domain on the same VPS. I have tried with virtual servers (both in /var/www/html/domain2 and /var/www/domain2) but had no luck. I think it might be because my actual domain is in /var/www/html when it should be in /var/www/domain1/html so as to create /var/www/domain2/html for the new domain.

Is there anything I can do to host both domains without having to delete the existing running domain (I would have to reinstall joomla as well which can be rather painful)? Can I “easily” migrate my existing domain to a subfolder (such as /var/www/domain1/html) so as to create (/var/www/domain2/html)?

Thanks for your help!

Show comments

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.

Hi @hansen & @jtittle,

Thank you for your replies.

I have been able to get through this with Virtualservers.

I am not sure what the problem was but after modifying /etc/httpd/conf/httpd.conf and the sites-enabled I was able to get this going. I added a new domain in a new folder without changing the joomla installation.

Thanks again for your help!

@Esteba

There’s no physical limitation imposed when it comes to where you’re able to host website data. The web server will look to whichever directory you define as the home or base path. For Apache, you’d be setting the home/base path using DocumentRoot.

So, for example, instead of worrying about moving the current site, you could create a new directory within the /home directory, such as:

/home/mynewsite/htdocs/public

Using:

mkdir -p /home/mynewsite/htdocs/public

You would upload all of your data to the ./public directory and then create a new VirtualHost for the domain as it shows in the guide that @hansen linked to.

If you run in to any issues with the setup, feel free to reply and let us know.