[ubuntu-in] Web Server

Ninad Pundalik ninadsp16289 at gmail.com
Tue Apr 7 17:44:45 BST 2009


Hi,

> sudo apt-get install apache2
>
> to start,stop and restart the server
>
> sudo /etc/init.d/apache2 start
> sudo /etc/init.d/apache2 stop
> sudo /etc/init.d/apache2 restart

A few things about the above:

1. Apache is one of the easiest to install, and also has lots of
documentation and help available.  It also is ver scalable, and
powerful.  However, if you just want to do some basic development work
on localhost, you can also give lighthttpd a try.  It is popular among
linux users, and you can find decent documentation for it.

2. To run any script in /etc/init.d, the newer (?), recommended way is
to use the invoke-rc.d command.  I quote the man page of invoke-rc.d:
"All access to the init scripts by Debian packages’ maintainer scripts
should be done through invoke-rc.d."

Here's an example of how to use it:

sudo invoke-rc.d <name of script> <option>

So, the above example of starting Apache becomes:
sudo invoke-rc.d apache2 start

3. For Apache, Ubuntu (and debian also i guess), the command to
control Apache is 'apache2ctl'.  So, all Apache starts, stops and
restarts are supposed to be done with this command.

sudo apache2ctl <start|stop|restart>

More options are available.  You can check the man page :)


Ninad S. Pundalik
http://ninadpundalik.co.cc/blog
GPG Key Fingerprint: 2DF7 B856 C75E C9F9 0504 C0EF D456 1946 7C45 2C69



More information about the ubuntu-in mailing list