← Back to team overview

enterprise-support team mailing list archive

[Question #705019]: Apache VirtualHost Issue

 

New question #705019 on apache2 in Ubuntu:
https://answers.launchpad.net/ubuntu/+source/apache2/+question/705019

Hello,

I am currently using an AWS EC2 (ubuntu 20.04) machine. I have installed apache2 and configured a two new sites at /var/www/myapp/myapp.html and /var/www/mynew/mynew.html. I created a new virtualhost file at the location /etc/apache/sites-available/myapp.conf. I have added 2 virtual host entries corresponding to the above sites. Enabled the myapp.conf file (a2ensite myapp.conf) and disabled the default virtualhost file (000-default.conf). As an experiment i put wrong IP:port combinations for the virtualhost directives , so that my request will not match any of the virtualhost. When i am trying to access the server , it serves the default webpage. But i was expecting the 1st virtualhost content.
Does anyone know why the disabled default webpage is displayed if no virtualhost matching the requested IP:port?

I have tried a different scenario, i changed the name of the default VirtualHost file from "000-default.conf" to "napp-default.conf", because i read somewhere that apache will read the VirtualHost files in the alphabetical order (my assumption was myapp.conf will be read first before napp-default.conf). But unfortunately i am getting the same output (default webpage) for the "nothing matches" scenario.


-- 
You received this question notification because your team Ubuntu
Server/Client Support Team is an answer contact for apache2 in Ubuntu.