I'm trying to set up a small VPS. When it was provisioned for me I was given the ip address , which dispays an apache2 page. I'd prefer to set things up using nginx. I asked the host about switching to nginx and got:
Apache is included with the template used to create the server.
All software installation, removal, updating and configuration is up to the end user. We provide pre-made server templates to you of the most commonly used software packages to help you get started.
Based on https://www.cyberciti.biz/faq/ubuntu-linux-start-restart-stop-apache-web-server/ , I'm trying to shutdown the apache server using:
deploy@server:~$ sudo systemctl stop apache2.service
deploy@server:~$ sudo systemctl status apache2.service
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: inactive (dead) since Thu 2017-01-12 21:24:23 EST; 4 days ago
Docs: man:systemd-sysv-generator(8)
Process: 28696 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCES
Process: 28681 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCC
Jan 17 11:09:17 server systemd[1]: Stopped LSB: Apache2 web server.
Warning: Journal has been rotated since unit was started. Log output is incomplete
But the default page is still visible at the url. What am I doing wrong?
edit:
deploy@server:~$ journalctl -xe
Hint: You are currently not seeing messages from other users and the system.
Users in the 'systemd-journal' group can see all messages. Pass -q to
turn off this notice.
No journal files were opened due to insufficient permissions.
deploy@server:~$ sudo service apache2 stop
[sudo] password for deploy:
deploy@server:~$
web page is still active. Please note that deploy is a non root account that I have created.
edit 2:
deploy@server:~$ ps aux | egrep apache2
deploy 17196 0.0 0.1 11228 888 pts/0 S+ 12:22 0:00 grep -E --color=auto apache2
edit 3: I found the following:
The binary is called apache2. Due to the use of environment variables, in the default configuration, apache2 needs to be started/stopped with /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not work with the default configuration.
edit 4: I switched to root:
root@server:/var/www/html# /etc/init.d/apache2 stop
[ ok ] Stopping apache2 (via systemctl): apache2.service.
root@server:/var/www/html#
No change . I also edited text in the index.html file and this is being served correctly.
edit 5:
root@server:/var/www/html# sudo systemctl stop apache2.service
root@server:/var/www/html# lynx http://localhost
I still see the webpage in the lynx browser
edit 6:
root@server:/var/www/html# sudo lsof -i tcp:80 | egrep LISTEN
nginx 28487 root 6u IPv4 603899449 0t0 TCP *:http (LISTEN)
nginx 28487 root 7u IPv6 603899450 0t0 TCP *:http (LISTEN)
nginx 28488 www-data 6u IPv4 603899449 0t0 TCP *:http (LISTEN)
nginx 28488 www-data 7u IPv6 603899450 0t0 TCP *:http (LISTEN)
edit 7:
root@server:/var/www/html# sudo update-rc.d -f apache2 remove
root@server:/var/www/html# sudo systemctl status apache2.service
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: inactive (dead)
Docs: man:systemd-sysv-generator(8)
Jan 17 12:59:58 server apache2[17860]: Action 'start' failed.
Jan 17 12:59:58 server apache2[17860]: The Apache error log may have more inform
Jan 17 12:59:58 server apache2[17860]: *
Jan 17 12:59:58 server apache2[17876]: * Stopping Apache httpd web server apach
Jan 17 12:59:58 server apache2[17876]: *
Jan 17 12:59:58 server systemd[1]: Started LSB: Apache2 web server.
Jan 17 13:01:04 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 14:16:05 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 14:16:54 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 14:20:45 server systemd[1]: Stopped LSB: Apache2 web server.
edit 8:
Jan 17 13:01:04 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 14:16:05 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 14:16:54 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 14:20:45 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 16:38:44 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 16:41:50 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 16:50:48 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 16:51:20 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 16:51:33 server systemd[1]: Stopped LSB: Apache2 web server.
Jan 17 16:51:45 server systemd[1]: Stopped LSB: Apache2 web server.
root@server:/var/www/html# sudo update-rc.d -f apache2 remove
root@server:/var/www/html#
journalctl -xe
says on the execution? – fugitive Jan 17 '17 at 16:28sudo service apache2 stop
? – You'reAGitForNotUsingGit Jan 17 '17 at 16:32ps aux | egrep apache2
? – L. D. James Jan 17 '17 at 16:56<?php echo phpinfo(); ?>
from a file in your root dir and see the results, what do you see ? – George Udosen Jan 17 '17 at 16:57