1

I have deployed my apps on apache and can access them from sites-available . but at a time I can enable 1 I think. how to enable both at a time in on diff port?

gamer
  • 113

1 Answers1

2

Add the 2nd port to listen to at /etc/apache2/ports.conf. It will have a line looking like

Listen 80

add a 2nd line to it with another portnumber (Listen 81 as an example).

Your config in sites-available has a <VirtualHost *:80 for port 80. Change that for the 2nd site to <VirtualHost *:81>. Change ServerName and DocumentRoot to the 2nd site. Also change the name of the error log so you have logs for both sites and not one combining them.

If you also need ssl: ports.conf will also have a section for that and you can duplicate that too: add a port inside the IfModule sections.

Restart apache for it to take effect.

Rinzwind
  • 299,756
  • thanks for reply sir are you saying that I can create 2 diff files like siteone.conf and sitetwo.conf and it should work ? – gamer Sep 01 '20 at 15:18
  • yes! put them in sites-AVAILABLE and symlink them to sites-ENABLED. Removing the symlink disables that site and you only need to edit the one in availble – Rinzwind Sep 01 '20 at 16:24