0

I've installed Nginx on Ubuntu 20.04.

I have removed Apache2 following these instructions.

(base) @pop-os:/$ which apache2
(base) @pop-os:/$ whereis apache2
apache2: /etc/apache2

I don't know if this tells me that Apache2 still remains.

I checked Nginx as follows:

(base) pop-os:/etc/apache2$ sudo nginx -t nginx: the configuration
file /etc/nginx/nginx.conf syntax is ok nginx: configuration file
/etc/nginx/nginx.conf test is successful (base) pop-os:/etc/apache2$
sudo systemctl reload nginx

It appears that all is well.

I checked to see which apps were listening on each port using the command

sudo lsof -nP -iTCP -sTCP:LISTEN

I see this output:

COMMAND     PID            USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd-r   855 systemd-resolve   13u  IPv4  26226      0t0  TCP 127.0.0.53:53 (LISTEN)
cupsd      1089            root    6u  IPv6  30746      0t0  TCP [::1]:631 (LISTEN)
cupsd      1089            root    7u  IPv4  30747      0t0  TCP 127.0.0.1:631 (LISTEN)
mongod     1229         mongodb   11u  IPv4  35955      0t0  TCP 127.0.0.1:27017 (LISTEN)
java       1235            root  140u  IPv6  38491      0t0  TCP *:8080 (LISTEN)
mysqld     1339           mysql   31u  IPv6  37368      0t0  TCP *:33060 (LISTEN)
mysqld     1339           mysql   33u  IPv4  35255      0t0  TCP 127.0.0.1:3306 (LISTEN)
postgres   1374        postgres    3u  IPv6  36937      0t0  TCP [::1]:5432 (LISTEN)
postgres   1374        postgres    4u  IPv4  36951      0t0  TCP 127.0.0.1:5432 (LISTEN)
postgres   1375        postgres    3u  IPv6  36949      0t0  TCP [::1]:5433 (LISTEN)
postgres   1375        postgres    4u  IPv4  36950      0t0  TCP 127.0.0.1:5433 (LISTEN)
nginx      7374            root    6u  IPv4  81554      0t0  TCP *:80 (LISTEN)
nginx      7374            root    7u  IPv6  81555      0t0  TCP *:80 (LISTEN)
nginx     19544        www-data    6u  IPv4  81554      0t0  TCP *:80 (LISTEN)
nginx     19544        www-data    7u  IPv6  81555      0t0  TCP *:80 (LISTEN)
nginx     19545        www-data    6u  IPv4  81554      0t0  TCP *:80 (LISTEN)
nginx     19545        www-data    7u  IPv6  81555      0t0  TCP *:80 (LISTEN)
nginx     19546        www-data    6u  IPv4  81554      0t0  TCP *:80 (LISTEN)
nginx     19546        www-data    7u  IPv6  81555      0t0  TCP *:80 (LISTEN)
nginx     19547        www-data    6u  IPv4  81554      0t0  TCP *:80 (LISTEN)
nginx     19547        www-data    7u  IPv6  81555      0t0  TCP *:80 (LISTEN)

Yet when I enter http://127.0.0.1 in Brave I see the Apache2 Ubuntu Default Page rendered. I expected to see Welcome to Nginx.

Why do I still see the default Apache2 page?

duffymo
  • 269

1 Answers1

1

The Apache Ubuntu page is placed in your webroot (/var/www/html) when you install Apache. This was not removed when you removed Apache, as files in your webroot are not necessarily directly related to Apache, and should be deleted manually if desired. When you installed Nginx, it placed its default file under the name of something like index.nginx-debian.html. When you requested the page, the server searched for an index (more info here), and found the one from Apache (index.html) before the one put there by Nginx. To fix this (though it is not really a problem per say), run the command

sudo rm /var/www/html/index.html

To delete the file from Apache.

  • Also, I'm a newbie here, so you may want to seek confirmation, but I don't think Pop OS is on topic here. You said Ubuntu 20.04 but your prompt says Pop OS, so not sure which you're using. – Pixelated Fish Oct 03 '20 at 00:50
  • Thank you so much. I saw that /var/www/html has index.nginx-debian.html. When I open it in Brave, I see the Nginx welcome page. Where else could I look for the Apache2 welcome page? Any other likely hiding places? – duffymo Oct 03 '20 at 00:54
  • Sorry. System 76 is a company that sells Ubuntu laptops. Pop_os is a synonym for Ubuntu 20.04. – duffymo Oct 03 '20 at 01:03
  • Last piece of the puzzle: caching content. I had to clear cached files from my Brave browser. When I hit localhost with Firefox the NGINX page came right up. It did the same for Brave after I cleared file cache. But I appreciate you pointing out /var/www/html. – duffymo Oct 03 '20 at 01:32