Finally, I found an answer for my question.
I did more troubleshooting and tried other scenarios as described below,
- Made sure the "ports.conf" file configured correctly.
- Checked the apache logs - but tbh i did not find any useful information.
- As a final check, I deleted the default virtualhost configuration file
(the remanamed nmapp-default.conf) -> but even after deleting the file
and restarting the server, apache was serving the same default webpage.
This made me to think that other than this default virtualHost file,
there is some different configuration exist and that redirect the apache
to the same default webpage.
My findings :
- Ran the command sudo apachectl -S to determine where/how my virtualhosts
were actually being loaded
- From the output of the command i got "Main DocumentRoot: "/var/www/html"
I searched for this and found the below details.
As the name already suggests, it is the default DocumentRoot value for virtual hosts when they themselves don’t specify one. So if a request matches a virtual host block which lacks a DocumentRoot directive to fulfil the request, Apache will use the default or main document root to serve the request.
Apache default document root specified in two places,
- Compile-time or Runtime options of httpd.
- The main server config which is the configuration specified outside the
virtual host blocks. Any virtual host configuration basically picks up
default values from the main server config (In my case, the value was not
mentioned anywhere in the main configuration file. ie, apache2.conf, so
it must be set during the runtime)
Note: The document root value specified in the main server config will override the one inherited from compile-time or runtime option
In other words, my main DocumentRoot was unconfigured and the default value was used until I explicitly defined it in a global configuration file.
Please refer this link for more information:
https://codingshower.com/apache-find-default-or-main-documentroot/#:~:text=The%20default%20or%20main%20document%20root%20acts%20as%20the%20default,and%20the%20main%20server%20config