Felitaur Site
Offerings
|
   
|
Starting up Apache
[Linux System Administration Homepage]
Overview |
Well, we have Linux installed, but as of yet the web server does
NOT seem to be working, and we want to alter the configuration so it runs
at boot time and users can set up web pages as well. Also to get familiar
with the location of many of the useful files needed to control the Apache Web Server, the most
commonly used
web server on the net.
Goals:
- understand how to start/stop servers
- edit run levels so apache starts up at boot
- locate server web page directory
- create user web page directory
- locate and modify apache configuration file
- restart server and test
- setup a dummy domain name and test
- locate information resources for apache
Files/directories covered:
- /etc (files: hosts inittab)
- /etc/rc.d/init.d/
- /etc/rc.d (subdirectories rc3.d long with rc0.d to rc6.d)
- /etc/httpd (subdirectory conf.d)
- /var/www/ (subdirectories: cgi-bin, html)
NOTE: On older systems this would be /home/httpd/html and
so on, or /usr/local/apache etc.)
- /var/log (files: messages)
- /var/log/httpd (files: access_log error_log)
Commands:
- /sbin/service httpd start|stop|restart|status
- /sbin/chkconfig --level 3 servername on
- useradd
- passwd
- mkdir
- ln -s
- vim
|
Questions |
- What is ServerRoot, where is it located? What is it?
- What is DocumentRoot, where is it located? What is it?
- How do you start and stop services?
- What port number does apache run on?
- What port number does apache-ssl run on?
- What is tux, what does it do?
- Why did we need to set the users home directory o+x ? (or 701)
- What does /etc/hosts do?
|
Activites |
In class I kind of wandered around as I tried to "trouble shoot"
or figure out why the various options were not working. Keep that in mind
as you work through these exercises. Don't just "follow the steps" but try
to understand WHAT and WHY we are doing them.
NOTE: for most of this, you will need to su to root in
order to have the proper permissions.
- Go into the /etc/rc.d/init.d where all the server
start/stop/restart scripts are kept and do a ./httpd start and a
(NOTE: If you are curious about what these scripts do,
use less or more to read them in this directory, they usually have a short
comment at the beginning to explain what they do).
- go into the directory that contains the symbolic links for run
level 3 (rc3.d somewhere inside of /etc) and use chkconfig to:
- remove these services
from run level 3
- add httpd to run level 3
- go to etc hosts and add a line
192.168.xx.xxx fakename.com
(Fill in xx.xxx with your present IP address, and
what you type for fakename.com is up to you)
- Start up netscape, first load up 192.168.xx.xxx, then
fakename.com (which mysteriously won't work yet) to make sure you can
contact your web server
- Go to /var/www/html and edit/create the index.html file to
make a
homepage
for your system
- Hit reload in netscape to see your changes
- Now, you need to allow users to create web directories.
- go edit httpd.conf (in /etc/httpd/conf.d directory)
- first make a backup by cp httpd.conf
httpd.conf.original
- Open the file with vi or pico
- NOTE lines such as "ServerRoot" and "DocumentRoot" and what
they are set to in the file.
- Search for ServerName (use ctrl-w to search in pico)
and set it to your fakename.com:80 (now fakename.com should work)
- Search for <Directory "/var/www/html"> and add
ExecCGI to the Options line.
- Go into the DocumentRoot (which is /var/www/html for now)
- create a symbolic link to /home/username/public_html where the name of the
link is the username
- add a public_html directory to /etc/skel
-
- NOTE: Error logs are now much more complex in recent
versions of Apache, so don't do the following that refer to error_log
- Uncomment the following two lines
CustomLog /var/log/httpd/referer_log referer
CustomLog /var/log/httpd/agent_log agent
- Uncomment ErrorDocument 404 /missing.html
- Log in as a simple user
- Go to that users home directory
- mkdir public_html
- copy your template.html to index.html, edit it slightly, and put it in
public_html
- If you try 192.168.xx.xxx/username/ it won't work yet, why?
- go to /home
- chmod o+x username (sets x on usernames home directory, or do chmod 701 username)
- 192.168.xx.xxx/username/ still won't work, why?
- Restart httpd so changes take effect
- Here is a neat trick, and another good reason to always make a
backup of a configuration file BEFORE you change it.
- Go back into /etc/httpd/conf
- type diff httpd.conf httpd.conf.original
- What does this give you?
|
References |
- Using netscape or mozilla, go to file, open, choose(browse)
- go to 127.0.0.1/manual
- Then in netscape click on bookmarks
- Slide to "file bookmarks"
- And put it in your personal toolbar folder
- Apache 1.3 Online
Documents
- Apache 2.2
Online
Documents
This page last updated on:
|
|
|