Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

225
Visualizações
how to host multiple virtual hosts from same IP address in Apache server over AWS?

I want to host two different angular panels over Apache (AWS). So I disabled the default 000-default.conf file in etc/apache2/sites-available using a2dissite 000-default.conf and made two files webAdmin.conf and webUIpanel.conf. Now my webAdmin.conf has the following configuration

<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   DocumentRoot /var/www/html/AngularProjects/getItHomeNow_UI/dist

   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

and webUIpanel.conf has following

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/AngularProjects/getItHomeNow_UserPanel/dist

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Then I used a2ensite to enable both config files and at last sudo systemctl restart apache2. But one of them working at a time. I need to disable one to make other work. Kindly suggest me where did I go wrong?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You should add ServerName in your VirtualHost config so Apache can decide which site should get the request. So to apply that to your config it should look like:

webAdmin.conf

<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   DocumentRoot /var/www/html/AngularProjects/getItHomeNow_UI/dist
   ServerName www.example1.com

   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

and webUIpanel.conf has following

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/AngularProjects/getItHomeNow_UserPanel/dist
    ServerName www.example2.com

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

NOTE: Both ServerName should be valid domains so they resolve to your server or use your /etc/hosts file to point them to your server IP.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda