This is the third of a series that will show the process of installing Redhat Linux 9.0 screen by screen. It is arranged in multiple threads to reduce the load time that is required for each thread, due to the intensive nature of the number of screens involved.
We strongly reccomend that you consult the Apache web site and do some research before you undertake a web site, it will eliminate humilations galore in your quest to get your web server the way you want it. The main menu for Apache documentation is; Apache 2.0 Documentation
Part I - Setting up a Red hat 9.0 Server - Click Here
Part II - Setting up a Red Hat 9.0 Server Part II - Click Here.
Configuring and Activating The Apache Webserver Component in Red Hat 9.0
The process of setting up the apache webserver component is simple and straight forward. You will spend more time figguring out WHAT to put on your pages, rather than getting them displayed. So let's get started!
- Logon on to your Linux system as Root or have the root password handy.
- Click on main menu (red Hat), System Settings, Server Settings, HTTP Server, you will see the following screen;
You will need a URL name to have a website. The URL name is what you enter for the server name. Enter the URL name (bitbenderforums.com), or, if you don't have a URL yet, and you just want to play, you can use your local static IP address, or, the loopback address 127.0.0.1. You should change the email address to something other than root. Once you have entered the items, click on the OK button. Then, close out the HTTP Server settings window, and confirm any changes.
- The next step is to start up the HTTPD daemon, so that apache can be called upon to serve your pages when requested. Double click on the Services Icon that is located in the "System Settings" window, and then scroll down until you see the httpd service in the left hand side of the window. If the box next to it is unticked, tick it by clicking inside the box;
One you have done this, the next thing is to do is to start the service. This is done by clicking on the Start button on the top left of the Services window;
The system will issue a message to indicate that the status of the HTTPD startup. Click on the OK button to close the pop up window.
- Now, close out the Services Window. You will be prompted to save the updates to the services start up. Click on OK to ensure that your webserver will be activated at every reboot of the system.
- Open a browser window on your Linux Desktop. Enter the Static IP address, or the local loopback address as http://127.0.0.1., and the Apache Test Page should be displayed if all is working properly;
(Note: You can click on the image to serve the page outside this article)
- The next test is a simple HTML page with graphics, and this was accomplished by the creation of a simple web page, and placement of the graphics files that it uses in the appropriate directories. Then, we reference the HTML file name that was used in our URL name;
(Note: You can click on the image to serve the page outside this article)
- Now, comes the step of copying the content that you want to serve into the appropriate directories. We will not suggest how to structure your directory entries, for it is out of scope for the intent of this article. The important directories that are set up by default by apache are;
* /var/www/html This directory is where you should store all HTML type files and images. If you use PHP for your website, it too should go in this directory.
* /var/www/cgi-bin This directory is where PERL, TOMCAT, JARKARTA, and binary web executables go.
Regardless of what types of web pages you use, the file permissions must also be set to allow the access to the files that you will be using for the web pages you serve. A permission setting of 755 is generally effective for most applications. Some vendor products will have you set up web directories that are 777 (R/W/E FOR ALL) access, but do not assign this access unless you really mean to allow ANYONE read/write/execute (and delete) access to that folder or file(s). Also, unlike Windows systems, files have permission sets too, and each file must have permission bits set to allow access.
- Most people in the IT world do not use the GUI interfaces to alter the apache configuration file (/etc/httpd/conf/conf.httpd). They use VI or some other editor and manipulate it manually. The advantages are that you get more granular control of the webserver component, and the disadvantage is that if you use the GUI after editing by hand, it may cause your updates to be lost.
For clarity, this article has suggested to use the GUI to first establish the web server component. As you get more and more familar and experienced, you will find that manual editing is the course you will use;
For more information on editing the httpd.conf file, we suggest the following link; Apache HTTPD Server 2.0 - Configuration
- Finally, you need to know where the apache webserver will communicate it's sucesses or failures. It does this via log files, but they are stored in a different place than the configuration files. The location for these files is /var/log/httpd;
The access_log will show the log entries for files served from your webserver.
The error_log will show the log entries for requested files that were unable to be served for one reason or another from your webserver.
The ssl_access_log will show the log entries for Secure (SSL) files served from your webserver.
The ssl_error_log will show the log entries for Secure (SSL) files that were unable to be served for one reason or another from your webserver.
The ssl_request_log will show the log entries for Secure (SSL) files that were unable to be served for one reason or another from your webserver.
I recommend viewing these logs daily, if you are running fairly active site, as there will be things in there of interest that you may want to repair or take other actions.
You can get all the details on log files at the apache site, via this link Apache Log Files
The best way to view large log files, is to use the tail command to assist you. Opening log files hundreds of megabytes in size will require plenty of memory and plenty of swap. Not the best thing to do on a running server.
With no switches provided, tail displays the last 10 lines of a file. That's not very useful, so you can use the -n switch to specify the number of lines:
tail -n 30 access_log
If you want to see all recent activity without having to open the whole file, specify the number of bytes to output using the -c switch (or number of lines with the -n switch if preferred), and direct the output to a text file. For example, to grab the last 200 kilobytes for viewing in a text editor:
tail -c 200000 access_log > /home/yourname/logtail.txt
Tail can also be used to continuously follow a file as it grows. It will continuously update the display and (by default) show the last ten lines of the file. A simple example is:
tail -f access_log
You can press ctrl+c to abort this process any time.
It is significant to note that this follows by file descriptor, not by name. So if you've run tail to continuously track a file, it will stop updating current activity after automated log rotation occurs. Instead, use:
tail --follow=name access_log
This will track the file by name instead. When the filename changes, it will follow the new access_log file.
If you are looking for entries containing specific information, you can also "grep" for strings and direct the output to a text file. For a simple example, to capture all entries pertaining to a specific resource:
grep 'filename.html' access_log > /home/yourname/greplog.txt
By redirecting output and getting manageable sized text files containing the desired information, you can use your favourite GUI text editor with all the buzzers whistles and bells to examine the log data.