Create multiple projects on the same server

I have an apache server on Linux Ubuntu.
So far I’m making one site, but I need to make a few more.

What can I do so that I can go to the site I need from the address bar?
now I enter http://localhost/ and go to one project, but you need, for example, http://new_project/ to go to another on the same computer.


Answer 1, authority 100%

If you installed Apache via apt-get(aptitude) then go to the /etc/apache2 folder, look for the httpd-vhosts.conf file, I have it in the conf/extra/ folder, but I assembled it by hand, so yours may differ. register a new virtual host

<virtualhost my.new=””>
ServerName my.new
ServerAdmin [email protected]
DocumentRoot /var/www/my.new/
</virtualhost>

this must be done as root

default apache folder here /var/www/ check how you are …
create a folder for the new project there.

then edit /etc/hosts as root and add the line there
127.0.0.1 my.new

restart apache

sudo /etc/apache2/apachectl restart

The new host will be available at http://my.new


Answer 2, authority 33%

read about VirtualHost


Answer 3

The easiest option (I do this) is to create folders with projects in the localhost folder, for example

http://localhost/site1/

http://localhost/site2/

etc.