- start -
sudo service apache2 start
- stop -
sudo service apache2 stop
- restart -
sudo service apache2 restart
- enable auto launch -
sudo systemctl enable apache2
- disable apache2 auto launch -
sudo systemctl disable apache2
(works on ubuntu 16.04 or later which use systemd
)
-
any process running on ports lower than 1024 needs sudo access
-
if you simply do
lsof -i:80
, you won't get the apache2 server'spid
-
you will have to use
sudo
sudo lsof -i:80 [sudo] password for $USERNAME: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME apache2 1251 root 4u IPv6 33732 0t0 TCP *:http (LISTEN) apache2 23440 www-data 4u IPv6 33732 0t0 TCP *:http (LISTEN) apache2 23441 www-data 4u IPv6 33732 0t0 TCP *:http (LISTEN) plugin_ho 23443 root 17u IPv4 1491055 0t0 TCP $USERNAME-laptop:52790->45.55.41.223:http (CLOSE_WAIT)
-
the process carrying the USER as
root
is the main one -
other processes carrying the USER as
www-data
are the child processes spawned from theroot
process