Installation Packages
-----------------------------
1- install package: apache2-mpm-prefork
Commands of Interest
-------------------------------
1- /etc/init.d/apache2 restart : restart the server with new configuration
2- a2ensite site.file.name : enable a site file
a2dissite site.file.name : disable a site file
3- a2enmod module name : enable an available module
a2dismod module name : disable an enabled module
Files and Directories
---------------------
1- /etc/apache2 : Configuration files
/etc/apache2/README : Documentation of configuration structure
/etc/apache2/apache2.conf : Main configuration file
/etc/apache2/conf.d/ : Directory of misc. configurations
/etc/apache2/mods-available/: Directory of available modules
/etc/apache2/mods-enabled/ : Directory of modules that are in use
/etc/apache2/sites-available/: Directory of available virtual hosts
/etc/apache2/sites-enabled/ : Directory of virtual hosts that are used
2- /var/www : parent directory for all sites
/var/www/domain : our site DocumentRoot(s)
3- /var/log/apache2 : log file directory
/var/log/apache2/error.log : start/stop/error messages
/var/log/apache2/access.log : log of HTTP requests
Specific Configuration Tasks
-----------------------------------------------------------------------
To allow the documenation to be read from campus
-----------------------------------------------------------------------
1- Edit /etc/apache2/conf.d/apache2-doc
Change this line:
================FROM======================
Allow from 127.0.0.0/255.0.0.0 ::1/128
=================TO=======================
Allow from 127.0.0.0/255.0.0.0 144.38.192.0/255.255.224.0 ::1/128
==========================================
2- /etc/init.d/apache2 restart
To set up organizational websites
-----------------------------------------------------------------------
0- su -
1- cd /etc/apache2/sites-available
2- edit default, add "ServerName your.server.name" directive to
VirtualHost configuration.
3- edit new.site.file
This is the site1.horgoth.com site file
========================================================================
<VirtualHost *>
ServerName horgoth.com
ServerAdmin webmaster@horgoth.com
DocumentRoot /var/www/site1.horgoth.com
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/site1.horgoth.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
========================================================================
This is the site2.horgoth.com site file
========================================================================
<VirtualHost *>
ServerName site2.horgoth.com
ServerAdmin webmaster@horgoth.com
DocumentRoot /var/www/site2.horgoth.com
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/site2.horgoth.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
========================================================================
4- Enable the new site with
a2ensite site1.horgoth.com
a2ensite site2.horgoth.com
5- Make directory for site
mkdir /var/www/site1.horgoth.com
mkdir /var/www/site2.horgoth.com
6- If not already defined, add the site name to DNS configuration.
The site name must resolve to the IP address of the server. If
www.site.name is desired, these names must also be configured
correctly.
7- /etc/init.d/apache2 restart
8- Set up content in DocumentRoot
9- Browse site with
http://site1.horgoth.com/document or http://site2.horgoth.com/document
To allow more than one DNS entry to be used by each virtual host
-----------------------------------------------------------------------
0- su
1- edit /etc/apache2/sites-available/site.file
2- add a line after the ServerName configuration:
========================================================================
ServerAlias www.site1.horgoth.com
========================================================================
3- /etc/init.d/apache2 restart
Citation: (course_default). (2007, November 27). HTTP Notes. Retrieved August 21, 2008, from Dixie State College of Utah Web site: http://pilot.educommons.usu.edu/dixiestate/computer-and-information-technology/it-3100-systems-design-and-adminsitration-i/http-notes.
Copyright 2007,
by the Contributing Authors.
This work is licensed under a
Creative Commons License.