What you're seeing is the index.html file that was installed by Apache. Do not trust solely the Index page being served as an indicator of the Web Server being used!

Just because you're seeing the Apache "default" page, doesn't mean that you're actually seeing Apache running, you're just seeing the 'default page' that was installed. Neither NGINX nor Apache will overwrite the index.html file in the default web root if it was already present (in an ideal situation), so whichever was present first is actually the one that installed the index.html file - it won't change just because you installed a different webserver.

You can confirm this by doing: sudo rm /var/www/html/index.html && echo "I am testing things!" | sudo tee /var/www/html/index.html and then refreshing your browser - you'll see that it's different content at this point.

If the nginx software at install time sees an index.html file already in the default webroot /var/www/html/, it is supposed to not overwrite it. This is normal, so users who use the default docroot for their websites don't lose their data.

What we need to do is confirm what Web Server is actually in use.
Always use actual command line tools to verify the web server software in use.

Leveraging sudo netstat -tulpn | grep :80 (an alternative command will be ss -tulpn | grep :80 if netstat isn't installed on your system) we can get an idea of what web server is in use:

$ sudo netstat -tulpn | grep :80
tcp6       0      0 :::80                   :::*                    LISTEN      1258/apache2

As you can see, this is an Apache2 web server listening on port 80.

Conversely, if the server is nginx you see something like this:

$ sudo netstat -tulpn | grep :80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      2772/nginx: master  
tcp6       0      0 :::80                   :::*                    LISTEN      2772/nginx: master

You can also determine if it's Apache2 or NGINX running by checking the output of one of the following commands:

$ pidof apache2
$ pidof nginx

Depending on which of these provides output, you can determine which web server is actually in use.

Answer from Thomas Ward on askubuntu.com
Top answer
1 of 4
11

What you're seeing is the index.html file that was installed by Apache. Do not trust solely the Index page being served as an indicator of the Web Server being used!

Just because you're seeing the Apache "default" page, doesn't mean that you're actually seeing Apache running, you're just seeing the 'default page' that was installed. Neither NGINX nor Apache will overwrite the index.html file in the default web root if it was already present (in an ideal situation), so whichever was present first is actually the one that installed the index.html file - it won't change just because you installed a different webserver.

You can confirm this by doing: sudo rm /var/www/html/index.html && echo "I am testing things!" | sudo tee /var/www/html/index.html and then refreshing your browser - you'll see that it's different content at this point.

If the nginx software at install time sees an index.html file already in the default webroot /var/www/html/, it is supposed to not overwrite it. This is normal, so users who use the default docroot for their websites don't lose their data.

What we need to do is confirm what Web Server is actually in use.
Always use actual command line tools to verify the web server software in use.

Leveraging sudo netstat -tulpn | grep :80 (an alternative command will be ss -tulpn | grep :80 if netstat isn't installed on your system) we can get an idea of what web server is in use:

$ sudo netstat -tulpn | grep :80
tcp6       0      0 :::80                   :::*                    LISTEN      1258/apache2

As you can see, this is an Apache2 web server listening on port 80.

Conversely, if the server is nginx you see something like this:

$ sudo netstat -tulpn | grep :80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      2772/nginx: master  
tcp6       0      0 :::80                   :::*                    LISTEN      2772/nginx: master

You can also determine if it's Apache2 or NGINX running by checking the output of one of the following commands:

$ pidof apache2
$ pidof nginx

Depending on which of these provides output, you can determine which web server is actually in use.

2 of 4
9

If you want to stop the Apache2 web server then command is

sudo systemctl stop apache2 --- Stop the server

sudo systemctl restart apache2 ---- Restart the web server

You can remove(permanently) the Apache2 web server by command.

sudo apt-get purge -y apache2* --- Uninstall the Apache2 server

After uninstall you can check in browser by entering your localhost(127.0.0.1)

People also ask

How do I make Apache start automatically after a reboot?
Run `sudo systemctl enable apache2` on Ubuntu/Debian or `sudo systemctl enable httpd` on RHEL-based systems. To confirm, run `sudo systemctl is-enabled apache2` — it should output `enabled`.
🌐
linuxize.com
linuxize.com › home › apache › how to start, stop, and restart apache on linux
How to Start, Stop, and Restart Apache on Linux | Linuxize
Where are the Apache log files?
On Ubuntu/Debian, logs are stored in `/var/log/apache2/` (`access.log` and `error.log`). On RHEL-based systems, logs are in `/var/log/httpd/`. Use `journalctl` to view systemd service logs: `sudo journalctl -u apache2`.
🌐
linuxize.com
linuxize.com › home › apache › how to start, stop, and restart apache on linux
How to Start, Stop, and Restart Apache on Linux | Linuxize
How do I check if Apache is running?
Run `sudo systemctl status apache2` on Ubuntu/Debian or `sudo systemctl status httpd` on RHEL-based systems. You can also run `curl -I http://localhost` to verify Apache is responding to HTTP requests.
🌐
linuxize.com
linuxize.com › home › apache › how to start, stop, and restart apache on linux
How to Start, Stop, and Restart Apache on Linux | Linuxize
🌐
nixCraft
cyberciti.biz › nixcraft › howto › apache › starting, stopping, and restarting apache 2 webserver command
Start / Stop and Restart Apache 2 Web Server Command - nixCraft
October 7, 2024 - # Start Apache 2 web server $ sudo /etc/init.d/apache2 start $ sudo service apache2 start # Restart Apache 2 web server $ sudo /etc/init.d/apache2 restart $ sudo service apache2 restart # Stop Apache 2 web server $ sudo /etc/init.d/apache2 stop $ sudo service apache2 stop
🌐
nixCraft
cyberciti.biz › nixcraft › howto › apache › how do i stop apache from starting on linux?
How do I stop Apache from starting on Linux? - nixCraft
March 4, 2022 - Use the following on RHEL/CentOS/Oracle/Fedora Linux: sudo systemctl disable httpd && sudo systemctl stop httpd · Ubuntu/Debian users run following command: sudo systemctl disable apache2 && sudo systemctl stop apache2
Top answer
1 of 1
2

You mentioned systemctl stop apache2, maybe because your Apache starts as a systemd service. If so, then the reason it gets restarted is most likely Restart= in the relevant service unit configuration file (apache2.service).

See man 5 systemd.service:

Restart=
Configures whether the service shall be restarted when the service process exits, is killed, or a timeout is reached. […]

Takes one of no, on-success, on-failure, on-abnormal, on-watchdog, on-abort, or always. If set to no (the default), the service will not be restarted. […]

Read the manual to learn the meaning of each possible value. Maybe you want Restart=no. If not, don't miss this fragment:

As exceptions to the setting above, the service will not be restarted if the exit code or signal is specified in RestartPreventExitStatus= […] or the service is stopped with systemctl stop or an equivalent operation. Also, the services will always be restarted if the exit code or signal is specified in RestartForceExitStatus= […].

If you want to use e.g. Restart=on-abort and still to be able to kill Apache with SIGKILL (kill -s KILL or kill -9) and not have it resurrected, consider placing

RestartPreventExitStatus=SIGKILL

in the unit configuration file.

Note SIGKILL should be used as a last resort. systemctl stop should be your earlier choice. I don't know what "emergency" you meant, but the fact the service got restarted makes me believe systemd was operational and most likely systemctl stop apache2 would work.

Find elsewhere
🌐
Linuxize
linuxize.com › home › apache › how to start, stop, and restart apache on linux
How to Start, Stop, and Restart Apache on Linux | Linuxize
March 3, 2026 - On Ubuntu/Debian, run sudo ufw status. On RHEL-based systems, run sudo firewall-cmd --list-all. Make sure port 80 (HTTP) and port 443 (HTTPS) are open. Configuration changes are not taking effect After editing any configuration file, run sudo ...
🌐
DebugBar
debugbar.com › how-to-completely-uninstall-apache2-on-ubuntu
How to Completely Uninstall Apache2 on Ubuntu? | DebugBar
Once the service is stopped, you can proceed with uninstalling Apache2 and its components. Use the apt command with the purge option to remove both the packages and their configuration files: sudo apt-get purge apache2 apache2-utils apache2-bin apache2.2-common · The apt package manager will handle the removal of all elements associated with Apache2 present on your Linux / Ubuntu system.
🌐
MainVPS Blogs
mainvps.net › home › how to stop apache server on ubuntu (the right way)
Stop Apache Server on Ubuntu: Step-by-Step Guide
March 12, 2025 - 1. How can I stop Apache on Ubuntu temporarily? Use sudo systemctl stop apache2.
🌐
Linux Genie
linuxgenie.net › home › how to start, stop, and restart apache on ubuntu 22.04?
How to Start, Stop, and Restart Apache on Ubuntu 22.04? - Linux Genie
January 11, 2024 - Apache on Ubuntu 22.04 has the service named “apache2”. To manage the “Apache”, Ubuntu has the “systemd” as its init system. Thus, it is recommended to use the “systemctl” command to start/stop/restart the Apache on Ubuntu 22.04.
🌐
LinuxVox
linuxvox.com › blog › ubuntu-apache2-stop
Understanding and Managing `ubuntu apache2 stop` — linuxvox.com
To stop the Apache2 service using systemctl, open a terminal and run the following command: ... The sudo command is used to run the command with administrative privileges because stopping a system service requires elevated permissions. You can verify if the service has stopped by checking its status: ... If the service has stopped successfully, the output will show that the service is inactive. The service command is an older way to manage services in Ubuntu.
🌐
Cloud Infrastructure Services
cloudinfrastructureservices.co.uk › home › blog › how to start / stop / restart apache 2 web server linux ubuntu
How To Start / Stop / Restart Apache 2 Web Server Linux Ubuntu
December 16, 2022 - How To Start / Stop / Restart Apache 2 Web Server Linux Ubuntu. In this tutorial, we walk you through how to start stop and restart the Apache web server on Ubuntu. For demonstration, we will use Ubuntu 22.04 which is the latest Ubuntu LTS release.
🌐
nixCraft
cyberciti.biz › nixcraft › howto › apache › ubuntu linux: start / restart / stop apache web server
Ubuntu Linux: Start / Restart / Stop Apache Web Server - nixCraft
April 4, 2016 - To restart Apache 2, enter: $ sudo service apache2 restart To stop Apache 2, enter: $ sudo service apache2 stop To start Apache 2, enter: $ sudo service apache2 start To gracefully reload Apache 2, enter: $ sudo service apache2 reload · The ...
🌐
GeeksforGeeks
geeksforgeeks.org › installation guide › how-to-start-stop-or-restart-apache-server-on-ubuntu
How to Start, Stop, or Restart Apache Server on Ubuntu? - GeeksforGeeks
June 6, 2024 - This tutorial will teach you the simple steps to start, stop, and restart Apache on Ubuntu computers. Apache is a software that runs websites on the internet. It needs to be started (turned on) before websites can be accessed. On Ubuntu computers, there is a simple way to start the Apache server. To start the Apache server on your Ubuntu computer type the below command into your terminal and after that use the second command to view the status of the apache2 ...
🌐
Bobcares
bobcares.com › blog › how-to-remove-and-reinstall-apache2-on-ubuntu-step-by-step-guide
How to Remove and Reinstall Apache2 on Ubuntu: Step-by-Step Guide
September 8, 2025 - How to Restore Apache2 Directory on Ubuntu/Debian · Run the following command to stop Apache2 before removal: sudo systemctl stop apache2 · Remove Apache2 and its related files with: sudo apt purge apache2 apache2-utils apache2-bin ...
🌐
Pi My Life Up
pimylifeup.com › home › how to start, stop, or restart apache on ubuntu
How to Start, Stop, or Restart Apache on Ubuntu - Pi My Life Up
April 23, 2023 - In this quick guide you will learn how to start, stop, restart or reload the Apache web server on the Ubuntu operating system.