简体   繁体   中英

After stopping Apache service, why can I still get Apache default page on my IP address?

I want to install Nginx, but the port 80 has been taken up by Apache2. I stop it by:

$ sudo kill -9 my-apache-pid

$ sudo service apache2 stop

$ sudo /etc/init.d/apache2 stop
[ ok ] Stopping apache2 (via systemctl): apache2.service.

and I can install Nginx. I use sudo systemctl status nginx . It shows working well and Apache2 seems inactive. But when I enter my IP address in the browser, it still shows Apache2 hello-page. Why?

I had the same problem. To my wonder clearing history and cookies of the browser worked.

Apache and Nginx home pages located in this directory:

/var/www/html

But there is a small point, and that is that each of these two apps that were installed earlier takes up the index.html file, and when you enter the address of localhost in the browser, that file actually opens.

As a result, all you have to do is go into this directory and see what the name of Nginx home file.you must do this in your terminal:

ls -l /var/www/html

that show index.nginx-debian.html name for Nginx html file, So if you search for this address in your browser:

localhost/index.nginx-debian.html

you can see the home page of Nginx.

all you need for show Nginx home page when search localhost is change then name of those two files.

Even after you remove apache2 completely, you will still have its "default site" files sitting in /var/www/

Run the following command and refresh the page.

mv /var/www/html/index.html index.html_bkp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM