Experimental topology:
Linux Client
-----RHEL5.9 (Vmnet1)----------(VMNET1)
Win7 Client
Experiment one: View the default HTTP configuration
Find the default Red Hat Welcome page
(/etc/httpd/conf/httpd.conf---->include---->
/ETC/HTTPD/CONF.D----> welcome.conf---->
/var/www/error/noindex.html)//through the master configuration file step-by-step to find the default
Page
Prerequisites:
1, configure IP
[Email protected] conf.d]# cat/etc/sysconfig/network-
Scripts/ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller
(Copper)
Device=eth0
Bootproto=static
Hwaddr=00:0c:29:db:02:ce
Onboot=yes
ipaddr=192.168.1.254
netmask=255.255.255.0
2, host name
[Email protected] conf.d]# cat/etc/sysconfig/network
Networking=yes
Networking_ipv6=yes
Hostname=svr1.tarena.com
geteway=192.168.1.1
3,hosts file
[Email protected] conf.d]# cat/etc/hosts
# don't remove the following line, or various programs
# that require network functionality would fail.
127.0.0.1 localhost.localdomain localhost
:: 1 localhost6.localdomain6 Localhost6
192.168.1.254 svr1.tarena.com SVR1
[[email protected] yum.repos.d]# yum-y install httpd//Installation
[Email protected] ~]# vim/etc/httpd/conf/httpd.conf
Include conf.d/*.conf//apply CONF.D with the end of. conf
File
[Email protected] conf.d]# service httpd restart
[[email protected] conf.d]# chkconfig httpd on//start service
Experiment two: Configuration of the basic HTTP server
Web server domain name: www.tarena.com
The default homepage includes: index.html, index.php
Turn on Keep connected
Verify that the default httpd supports PHP
Web site with teacher-provided test_web.zip test
Server operation:
[Email protected] ~]# cd/etc/httpd/conf
[[email protected] conf]# CP httpd.conf Httpd.conf.bak//Backup
Master configuration file
[[email protected] ~]# vim/etc/httpd/conf/httpd.conf//Modify
Parameters
...
KeepAlive on//Open hold Connection
...
265 ServerName www.tarena.com//server domain name
...
391 directoryindex index.html index.php//default home file
...
[Email protected] ~]# cd/root/desktop/
[Email protected] desktop]# Unzip Test_web.zip
[Email protected] desktop]# MV jiajutiyan/*/var/www/html/
Put the test page into the default root path of the site/var/www/html
4. Write Test PHP page
[[email protected] ~]# cat/var/www/html/test.php//write a PHP test
Document
<?php
Phpinfo ();
?>
Test:
[Email protected] ~]# elinks http://www.tarena.com//linux text module
ELinks can be used to test whether the Web page is accessible
192.168.10.254 www.tarena.com www//Specify the hosts in the client
Thing
Http://www.tarena.com//will show the net under/var/www/html
Stand
http://www.tarena.com/test.php//Check if PHP is supported and not installed now
PHP so see the characters written in the document
Experiment Three:
Allow only 192.168.1.10 access to http://www.tarena.com
Allow all users to access http://www.tarena.com/authdir/index.html
[Email protected] html]# vim/etc/httpd/conf/httpd.conf
<directory/var/www/html>
Order Allow,deny//Authentication rule Allow,deny First allow again deny, default
Deny all; Deny,allow for first refusal in the Allow, default allows all
# Allow from all
Allow from 192.168.1.10//Permit 192.168.1.10 Access
Http://www.tarena.com
</Directory>
<directory/var/www/html/authdir>
Order Allow,deny
Allow from all//permit All Access
http://www.tarena.com/authdir/
</directory>
[Email protected] html]# mkdir-p/var/www/html/authdir
[Email protected] html]# echo "AAAAA"
>/var/www/html/authdir/index.html
Restart the service after the client test results should be 1.10 can access the above two sites, which
His client can only access http://www.tarena.com/authdir/index.html
Experiment Four: HTTP user authorized Client Access Http://www.tarena.com/authdir need to
To enter user name password Authentication
1. Modify the master configuration file
[Email protected] html]# vim/etc/httpd/conf/httpd.conf
<directory/var/www/html/authdir>
Order Allow,deny
Allow from all
AuthName "Please input password!" For pop-up window tips
AuthType "Basic"//certification category, generally basic
AuthUserFile "/ETC/HTTPD/.PASSWD"//authenticated user file
Require Valid-user//specify authorized users or groups
Valid-user for all authenticated users can also be written as user user1 user2 ... group
Group 1 Group 2 ...
</directory>
[Email protected] html]# htpasswd-c/etc/httpd/.passwd user1//Gen
Build authentication User-C means to create a new file, add it at the first time, and then create a user
Users before-C will be emptied
New Password:
Re-type New Password:
Adding Password for user user1
Restart the service in the client test
Experiment five: HTTP directory aliases
Clients can visit HTTP://WWW.TARENA.COM/AA when accessing
Ask/var/www/html/aa/bb under the page
1. Create a test Site
[Email protected] html]# cd/var/www/html/
[Email protected] html]# mkdir-p aa/bb/
[Email protected] html]# echo "2. Modify the configuration file
[Email protected] html]# vim/etc/httpd/conf/httpd.conf
Alias/aa/var/www/html/aa/bb
After restarting the service, test on the client
Experiment Six:
See how the default HTTP usage process is managed
Change the default process management mode to worker mode
[[email protected] bb]# httpd-l view httpd enabled modules
Compiled in Modules:
Core.c
PREFORK.C//httpd default mode of operation, relatively stable, but high resource consumption
Http_core.c
Mod_so.c
Change the prefork mode to worker mode
[Email protected] bb]# cd/usr/sbin/
[Email protected] sbin]# MV httpd httpd.prefork
[[Email protected] sbin]# mv Httpd.worker httpd//Mobile startup script
[[Email protected] sbin]# service httpd restart//Restart Services view
Effect
[Email protected] sbin]# httpd-l
Compiled in Modules:
Core.c
WORKER.C//Discovery Boot mode changed to Worker,worker processing high
Concurrency is more powerful, but unstable
Http_core.c
Mod_so.c
<ifmodule prefork.c>//prefork.c Configuration prefork Module
Startservers 8//Open 8 processes when starting service
Minspareservers 5//Minimum number of idle processes, less than 5 idle process to create a new
The process
Maxspareservers 20//MAX Idle Process
Serverlimit 256//process limit is within 265
MaxClients 256//maximum number of processes, not greater than serverlimit
Maxrequestsperchild 4000//Maximum request
</IfModule>
Test Seven:
Deploying Awstats Statistics HTTP access logs
1, unzip the installation
[Email protected] ~]# tar zxf awstats-7.1.tar.gz-c/usr/src/
[Email protected] ~]# cd/usr/src/
[Email protected] src]# MV AWSTATS-7.1//usr/local/awstats
[Email protected] src]# cd/usr/local/awstats/
[[email protected] awstats]#./tools/awstats_configure.pl//Configuration script
Enter full config file path of your WEB server.
Example:/etc/httpd/httpd.conf
Example:/usr/local/apache2/conf/httpd.conf
Example:c:\program Files\apache group\apache\conf\httpd.conf
Config file path (' None ' to skip Web server Setup):
>/etc/httpd/conf/httpd.conf//httpd master configuration file path
-----> need to create a new config file?
Do you want me to build a new AWStats Config/profile
File (required if first install) [y/n]? Y//Create a new match
File
-----> Define Config file name to create
What's the name of the your Web site or profile?
Example:www.mysite.com
Example:demo
Your Web site, virtual server or profile name:
> www.tarena.com//Domain name
-----> Define Config file path
In which directory does you plan to store your config file (s)?
Default:/etc/awstats
Directory path to store config file (s) (Enter for default):
>//profile path, default, all the way to complete the installation
[[email protected] awstats]# mkdir-p/var/lib/awstats//CREATE DATABASE text
Piece Clamp
[Email protected] awstats]# vim
/etc/awstats/awstats.www.tarena.com.conf
Logfile= "/var/log/httpd/access_log"//Modify HTTPD log path
[Email protected] awstats]#
/usr/local/awstats/tools/awstats_updateall.pl Now//update
Log file
[[email protected] awstats]# CRONTAB-E//Add Scheduled task, refresh once in five minutes
*/8 * * * */usr/local/awstats/tools/awstats_updateall.pl now
[Email protected] awstats]# vim/var/www/html/awstats.html//Through
HTML language for Web page jump function
<body>
</body>
Restart Service test
Modifying the Hosts file on the client
192.168.1.254 www.tarena.com
Then access via www.tarena.com/awstats.html