How do I stop my local apache server?
/etc/init.d/apache2
and service apache2
give only 3 options -- restart
, start
and status
I rebooted my syetem and now sudo /etc/inid.d/apache stop
works but doesn't give the stop
option on TAB
httpd
was missing so I did sudo ln -s /usr/sbin/apachectl /etc/init.d/httpd
-- read it on some forum
The httpd service now gives start
and status
option (Again, no stop
)
doing sudo /etc/init.d/httpd status
says
Looking up localhost
Making HTTP connection to localhost
Alert!: Unable to connect to remote host.
lynx: Can't access startfile http://localhost/server-status
'www-browser -dump http://localhost:80/server-status' failed.
Maybe you need to install a package providing www-browser or you
need to adjust the APACHE_LYNX variable in /etc/apache2/envvars
I did install lynx just before making the link by sudo apt-get install lynx
Why is only the stop
missing? This is just plain weird ...
Here's how i kill it:
make sure it is off, or that the process isn't running
(says the only instance of Apache is my query)
Starting back up:
Other methods, include
You could kill apache2 many other ways:
(find apache's pid ps aux | grep apac) or use top to find the PID of apache2)
This line:
you probably meant init.d
That might just be a typo though, I am not sure.
You could also use the apache2ctl command.
That handles the service and all in a short command. Other commands like
start
,restart
are also supported.Okay! Apache is restarting successfully but just isn't sure where that it want serve from, as it is choosing your localhost (127.0.0.1) by default. To prevent this message from appearing, add the following line into your
/etc/apache2/apache2.conf
file:P.S.: Make sure that you want to serve from localhost (127.0.0.1)
More: How to fix Apache – "Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName" Error on Ubuntu
$ sudo service apache2 stop
worked for me . I was getting error while starting tomcat7 in eclipse but it show error "Port already in use for 8080 and 8005" as the ports were already acquired by apache2 (i.e for php server).