Article Title: ApacheWeb Server Installation Guide. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Abstract: This article discusses how to install apache web servers that support mod_perl, mod_ssl, and php, and install webalizer to analyze web access logs. Guide beginners to edit a secure and fully functional web server system.
Required Software
Apache_1.3.20.tar.gz home: http://www.apache.org local
Mod_perl-1.26.tar.gz home: http://perl.apache.org local
Openssl-0.9.6b.tar.gz home: http://www.openssl.org local
Mod_ssl-2.8.4-1.3.20.tar.gz home: http://www.modssl.org local
Php-4.0.6.tar.gz home: http://php.apache.org local
Webalizer-2.01-06-src.tgz home: http://www.mrunix.net/webalizerlocal
Gd-1.8.4.tar.gz home page: http://www.boutell.com/gdlocal
In addition, the system must install the following rpm packages:
Libpng-devel zlib-devel libjpeg-devel
You can run the rpm-qa | grep libpnp command to check whether the system has these rpm packages installed. If not, load the redhat installation disc and install these rpm packages in/mnt/cdrom/RedHat/RPMS.
Step 1: Install openssl
1. Unzip the software:
# Tar xvfz openssl-0.9.6b.tar.gz
2. Installation
# Cd openssl-0.9.6b #./config # make test # make install
Step 2: Install mod_ssl
1. Unzip mod_ssl
# Tar xvfz apache_1.3.20.tar.gz # tar xvfz mod_ssl-2.8.4-1.3.20.tar.gz
2. Install mod_ssl
# Cd mod_ssl-2.8.4-1.3.20 #./configure -- with-apache = ...... /Apache_1.3.20
Step 3: Install mod_perl
1. Extract
# Tar xvfz mod_perl-1.26.tar.gz
2. Installation
$ Perl Makefile. pl everything = 1 APACHE_SRC = ...... /Apache_1.3.20/src USE_APACI = 1 PREP_HTTPD = 1 DO_HTTPD = 1 $ make install
Step 4: Configure apache
# Cd apache_1.3.20 #./configure
Step 5: install php
1. Extract
# Tar xvfz php-4.0.6.tar.gz
2. Installation
# Cd php-4.0.6 # CFLAGS = '-O2-I/usr/local/ssl/include/openssl' #./configure -- with-apache = ...... /Apache_1.3.20 -- with-mysql -- with-gd = ...... /Gd-1.8.4 -- enable-memory-limit = yes -- enable-debug = no # gmake install
Step 6: install apache
# SSL_BASE = ...... /Openssl-0.9.6b #. /configure -- enable-module = ssl -- activate-module = src/modules/perl/libperl. a -- enable-module = perl -- activate-module = src/modules/php4/libphp4.a -- enable-module = php4 # make certificate # make install
Step 7: Install gd
# Make all # cp libgd. a/usr/lib # cp gd *. h/usr/include/
Step 8: Install webalizer
1. Extract
# Tar xvfI webalizer-2.01-06-src.tar.bz2
2. Installation
# D webalizer-2.01-06 #./configure # make install
3. Configuration
Rename webalizer. conf. sample Under/etc/to webalizer. conf.
Modify the following content based on the actual Server:
LogFile/usr/local/apache/logs/access_log
Set the location of the www access log file
OutputDir/usr/local/apache/htdocs/usage
Set the web Access statistics output directory
HistoryName webalizer. hist
Incremental yes
HostName www.test.com
PageType htm * PageType cgiPageType phtmlPageType php3PageType plPageType jsp
4. Set a cron task
Add the following content at the end of the/etc/crontab file:
02 4 *** root/usr/local/bin/webalizer
You can.
5. Create an output directory
# Mkdir/usr/local/apache/htdocs/usage
Step 9: Protect access statistics from unauthorized access
We certainly do not want our Website access statistics to be browsed by others at will. Therefore, we need to protect the usage directory and only allow access by legal users.
I. Conditions
The website www.test.com has the following settings for "/": DocumentRoot/usr/local/apache/htdocsAccessFileName. htaccessAllowOverride All
Ii. Requirements
Requirement: restrict access to the/usr/local/apache/htdocs/usage/directory. Only the user "admin" can access this directory with the password "12345678.
3. Use htpasswd to create User Files
Htpasswd-c/usr/local/apache/. htpasswd admin
This program will ask the user "admin" password, you enter "12345678", take effect twice.
4. Creation. Htaccess File
Use vi to create a file in the/usr/local/apache/htdocs/usage/directory. Htaccess: Write the following lines:
AuthName admin-onlyAuthType BasicAuthUserFile/usr/local/apache/. htpasswdrequire user admin
V. Test
In this case, you can access ghost through a browser.