How to Setup an Apache Server

How to Setup an Apache Server thumbnail
Set up an Apache Web server.

Apache server started its life as "a patchy server," but has become one of the most popular Web servers available today. It is a robust, full-featured and free server software package. Ubuntu is a free implementation of Linux and provides a very stable platform on which to install the Apache Web server. The Resources section provides help for implementing Apache on other Linux flavors.

Things You'll Need

  • Computer with Ubuntu Linux installed
  • Internet link
Show More

Instructions

    • 1

      Update Ubuntu Linux by issuing the following command at the prompt to update Ubuntu:

      sudo apt-get update

      This will update your Ubuntu server with the most current software available.

    • 2

      Download and install the Apache 2 software by issuing the following command at the prompt:

      sudo apt-get install apache2

      This will locate the Apache 2 server software and install it for you.

    • 3

      Copy the default site configuration file to a new file with the name of your server. The following command will accomplish this:

      sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/yourserver

      From here, you will work with the new copy of the configuration file to define your Web server.

    • 4

      Update the new configuration file so that Apache will be able to serve up your pages. Using a text editor (vi, gedit, nano), open /etc/apache2/apache2.conf and make sure the following line is present.

      DocumentRoot /var/www

      If you have to add or modify the line, be sure to save the file to capture your changes.

    • 5

      Update the main Apache configuration file to tell it about your server with the following command:

      gedit /etc/apache2/conf.d/fqdn

      Add the following line to the file and save it:

      ServerName localhost

    • 6

      Update the the following lines in the site configuration file you created in Step 3:

      ServerAdmin youremail@localhost.com (the default is webmaster@localhost)

      Servername yourserver (the fully qualified domain name)

      DocumentRoot /var/www/yourserver (where Apache looks for pages)

    • 7

      Disable the default site and enable your new site with the following commands:

      sudo a2dissite default

      sudo a2ensite yourserver

      This will allow Apache to begin serving pages associated with your new server.

    • 8

      Start your Apache server with the following command:

      sudo /etc/init.d/apache2 start

      Alternatively, the following command will restart the server:

      sudo /etc/init.d/apache2 restart

      This will start (or restart) your server and make it ready to serve pages.

    • 9

      Create a new directory for your server's pages with the following command:

      sudo mkdir /var/www/yourserver

      This is the directory where you will place the pages for the server named "yourserver."

    • 10

      Put your home page in your default Web directory for Apache (/var/www/yourserver), and name it "index.html." Start a browser session on the server, enter "localhost" in the address bar and press "Enter." This should bring up your default page (index.html). Build your Web site out, and you are ready to go.

Related Searches:

References

Resources

  • Photo Credit http, www, icon, web, website image by creative from Fotolia.com

Comments

You May Also Like

Related Ads

Featured