Why do I still see an Apache site on Nginx?
I installed nginx then I installed apache2, after a while I removed apache2. After a couple of weeks I noticed something strange when I accessed http://localhost
: nginx handles the request but when I type in my IP address or anyone in my network types in my IP, it results in an apache2 page loading saying it's correctly working.
I purged and removed Apache but I still can't get rid of this problem, tried reinstalling and purging again then restarting. Any ideas of what could be the problem?
PS my computer doesn't recognize apache2 as being installed in anyway and all Apache files and binaries are not found even when I manually search for them.
root@elite-HP-Pro3500-G2-MT-PC:/home/elite# whereis apache2
apache2:
root@elite-HP-Pro3500-G2-MT-PC:/home/elite# sudo service apache2 start
Failed to start apache2.service: Unit apache2.service failed to load: No such file or directory.
root@elite-HP-Pro3500-G2-MT-PC:/home/elite# sudo apt-get purge apache2 apache2-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'apache2' is not installed, so not removed
Package 'apache2-utils' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.
Even after you remove apache2 completely, you will still have its "default site" files sitting in /var/www/
. By default, Nginx will attempt to serve these or its own version of these files for sites it cannot otherwise match. You can see this all in /etc/nginx/sites-available/default
.
What you're seeing is by design, it was just unexpected.
To fix it, you can edit or remove the default site... Or alter the files in /var/www/
to better suit your needs. If you want rid of the default, you can delete /etc/nginx/sites-available/default
. It's just a symlink so if you want to restore it, you can with:
sudo ln -s /etc/nginx/sites-{available,enabled}/default
And remember to reload after making configuration changes:
sudo service nginx configtest # make sure the config is good before reloading!
sudo service nginx reload
Both Nginx and Apache are referring to the /var/www
HTML file.
Run this command and refresh the page:
mv /var/www/html/index.html index.html_bkp