1

i installed nginx on server(ubuntu 16.04) which already had apache2 and, done this following configuration,

->changed apache port 80 to 8888 so nginx would listen to 80
->restarted apache and nginx in sequence.

still getting apache default page when i type http://localhost i also stopped apache2 service and restarted nginx service to ensure only once server run at time but still getting apache default page on localhost request!!! which should be actually nginx default page cuase apache service is not running anymore.

One thing i found suspicious is 'htcacheclean' process is running,is that responsible for the returning Apache page?!

how this is happening is strange for me!! kindly share hint if you ever faced this kind of issue.

ss -tlnp return following for the port 80
State   Recv-Q  Send-Q     Local Address:Port   Peer Address:Port
LISTEN    0        0                     *:80                      **:* *

ss -tlnp | grep nginx command output shows nginx

ss -tlnp | grep nginx command output

DexJ
  • 111
  • 1
  • 4
  • On what port does `nginx` run in your machine? It defaults to apache because `apache2` uses port `80` by default. How does your `/etc/nginx/nginx.conf` look like? What does `ss -tlnp` return or rather, what does `lsof -i :80` return` when apache is not active and `nginx` is.? – Valentin Bajrami Oct 09 '17 at 11:12
  • Have you cleared your browser cache? – Richard Smith Oct 09 '17 at 11:20
  • Yes cleared cache and checked @RichardSmith! – DexJ Oct 09 '17 at 12:11
  • ss -tlnp command output updated in question @val0x00ff – DexJ Oct 09 '17 at 12:20
  • 1
    @DexJ I need to know the service name on that port. Can you run `ss -tlnp | grep nginx` or `lsof -i :80`. If `lsof` command is not available you can install it using `aptitude install lsof` – Valentin Bajrami Oct 09 '17 at 12:49
  • can you run `curl -I http://` please, so you can see if the webserver answering is nginx or apache – Diego Velez Oct 09 '17 at 14:27
  • 6
    You should check if Apache and Nginx have the same document root directory. In this case, check the document root directory (usually it is `/var/www/html/`) and if there is `index.html` file remove it, or rename it. Most likely it is the default `index.html` file created by Apache. – RoseHosting Oct 09 '17 at 14:53
  • @val0x00ff updated ss -tlnp | grep nginx commnad output in question it says nginx – DexJ Oct 10 '17 at 04:50
  • if this is not prod server , just disable apache server for a while and see the results.. as said if its still saving apachee default page its to do with index file as said by Rosehosting – Aravinda Oct 10 '17 at 04:53
  • after disabling apache and clearing browser cache and after verifying document root, still its there ? then go for clearing nigix cache.. https://stackoverflow.com/questions/6236078/how-to-clear-the-cache-of-nginx may be nigix is holding a copy ! – Aravinda Oct 10 '17 at 04:56
  • @DiegoVelez it shows apache 2 while i am requesting but isn't that weird cause i checked > service --status-all and found apache process is not running...! but i found another related process updated question plz check :) – DexJ Oct 10 '17 at 10:09

1 Answers1

1

Its because nginx may have same DocumentRoot as apache and It's index.html is still in /var/www/html. I had the same problem.

Vaibhav Panmand
  • 959
  • 5
  • 17
kyle
  • 11
  • 1