Question

Installing second website to single Ubuntu VPS running apache2

Posted October 26, 2020 154 views
Apache

This is a test environment so i dont have a domain.

I have a VPS with apache2 installed and i have a website located at
/var/www/html .
I access it via going to my ipaddress/index.php

I want to set up another website let’s say at
/var/www/site2
and be able to acceess at ipaddress/site2/index.php

How can i achieve this? The guides didn’t really help me i think im losing it somewhere in the /etc/apache2/sites-available configuration.

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.

×
1 answer

Hi @brightfuture,

If you want to use the IP address, you can create another folder located in /var/www/html, let’s say exampleFolder. It will be located in /var/www/html/exampleFolder. Additionally, if you want to browse the folder, you’ll need to open ipaddress/exampleFolder.

Now, if you want to open another directory, you won’t be able to use an IP address. Having said that, you can configure a domain of your liking and then edit the host file on your computer to point the domain you have used to your droplet. If you like this idea, let me know and I’ll walk you through it!

Regards,
KFSys

  • Hey so i went ahead and added my IP ADDRESS along with the ServerName on my hosts windows file and it worked :).

    The thing is i have an openLdap database and the system i want to install supports ldap , would it possible if i set it up like this my site to communicate with the ldap or nah?

    Ldap is installed on the same VPS if that makes any difference and already works with my first site.

    • On a side note i am wondering if i was setting up the second site inside html/secondSite . Would the secondSite interfere with the first or it would be like it was a clean installation on a new server . Because inside html folders there are my sites files.
      It’s not like /var/www/html/site1 it’s /var/www/html/allMySiteFiles

      • It’s fine to set it in another folder inside /var/www/html. It won’t interfere with your other website, in fact this is commonly used in cPanel’s public_html.

        Regards,
        KFSys

    • Hi @brightfuture,

      You should be able to configure it, yes. Even if you are using a host file this shouldn’t be a problem.

Submit an Answer