Oct 22

How to Install and Configure Apache

In this write up I’m going to teach you how to install and configure Apache. First login as usual and sign in with root privileges by typing “su.” Here it will prompt you for your password. Create a folder named Lab06 in your /home/(username goes here)/ directory and then change to your tmp folder.
In this case I was installing at a school so you’ll have to work with the directions you don’t understand. From the command line, login to the class server using FTP and download httpd-2.xxx.tar.gz to your /tmp directory. Logout and uncompress/untar the downloaded file.
Place the user files in /usr/local/apache and set the enable-module to “all.” Then set the enabled-shard to “max.” Now enter in the command line enter “./configure –prefix=/usr/local/apache \
–enable-moedule=all –enable-shared=max.” Now create and install httpd. Make a backup copy of the /etc/httpd/httpd.conf file incase of any mistakes, it’s always better to be safe than sorry. The changes that need to be made are in the Document Root, ServerRoot, and /home/(your username here)/Lab06/chkconfig.txt and now start XWindows. Open Mozilla and enter your address. You should see notification that Apache is running (because you haven’t yet uploaded webpages.)
Now that it’s installed, here is more configuration type details to the Apache server. If you’d like to restrict your webpage to people with usernames and passwords here is how. Using Apache’s htpasswd utility, create username and passwords for login. Here you must give the location and name of the password file. If there is no password file then you must include the –c option to create to th e command line. To create a username and password type htpasswd –c /etc/httpd/conf/.htpasswd (username here). To add a password type htpasswd /etc/httpd/conf/.htpasswd (username here) (without the –c). Set the permission for .htpasswd to make it read only by a specific group(s) by typing chmod 644 /etc/http/conf/.htpasswd.
Now create an .htaccess file where you want password control by using vi to edit “/usr/local/apache/htdocs/secret/.htaccess. After changing to insert mode enter the following:
AuthName “Login Required”
AuthType Basic
AuthUserFile /etc/httpd/conf/.htpasswd
AuthGroupFile /dev/null
require user (username here) username
and now write and quit.
Now place a directive in the file which defines access to the /usr/local/apache/htdocs directory and all directories higher up than it by typing the following:

Servername (IP ADDRESS HERE)
DocumentRoot /usr/local/apache/htdocs

Now restart Apache. When trying to access it you should now be prompted for a username and password. You’re almost done. Change the director to /home/(your username/Lab06 and copy /etc/httpd/conf/httpd.conf, /etc/httpd/conf/.htpasswd, and /usr/local/apache/htdocs/secret/.htaccess. Then change ownership of the directory /home/(your username/Lab06 as well of all of the files in it from root to your username and you’re all done. Enjoy your Apache web server!

Mathew Gajewski

Warning: count(): Parameter must be an array or an object that implements Countable in /homepages/4/d289686807/htdocs/drpcrepair/blog/wp-includes/class-wp-comment-query.php on line 405

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>