Setting up, testing a web page, and starting Apache using Ubuntu can be accomplished in just a few steps. First, make sure that Apache is installed on your system. Either select it during installation or install the server and related package files (refer to Chapter 7 if you need to install the server software).
Next, set up a home page for your system by editing (as root) the file named index.html under the /var/www directory on your system. Make a backup copy of the original page or www directory before you begin so you can restore your web server to its default state if necessary.
|"View full width] Start Apache through the Services window (under System, Administration from the menu bar), making sure to enable "Web Server".
You can also use the apache2 script under the /etc/init.d/ directory, like this:
sudo /etc/init.d/apache2 start
You can then check your home page by running a favorite browser and using localhost, your system's hostname, or its Internet Protocol (IP) address in the URL. For example, with the links text browser, use a command line like this:
# links http://localhost/
For security reasons, you should not start and run Apache as root if your host is connected to the Internet or a company intranet. Fortunately, Apache is set to run as the user and group www-data no matter how it is started (by the User and Group settings in /etc/apache2/httpd.conf). Despite this safe default, Apache should be started and managed by the user named apache, defined in /etc/passwd as www-data:x:33:33:www-data:/var/www:/sbin/nologin
After you are satisfied with your website, use the Services configuration dialog to ensure that Apache is started.
Was this article helpful?