WWW Service
1. wwwWorld wide web, Global Information Network) is a logical network built on the Internet and represented by WEB Services.
2. WEB Service Implementation Program: ms iis, Apache, SunONE, and NCSA httpd
Install Apache
1. Installation Package Structure
Httpd-2.2.3-6.el5.i386.rpm main program
Httpd-manual-2.2.3-6.el5.i386.rpm Apache Manual
Httpd-devel-2.2.3-6.el5.i386.rpm Development Library
System-config-httpd-1.3.3.1-1.el5.noarch.rpm graphics Configuration Tool
2. Start Apache testing and installation: Service name httpd
3. configuration file/etc/httpd/conf/httpd. conf
Configuration and management of Apache services
I. basic configuration of Apache service
1. configuration file/etc/httpd/conf/httpd. conf
Structure: Section 1: Global Environment Global configuration)
Section 2: 'main' server configuration master server configuration)
Section 3: Virtual Hosts Virtual host configuration)
Ii. basic configuration of Apache
1. Set the Apache home directory
279 DocumentRoot "/var/www/html"
DocumentRoot "absolute path of Apache main directory"
2. Set the Apache homepage File
390 DirectoryIndex index.html. var
DirectoryIndex sequence 1 file sequence 2 files... sequence n files
3. Set the listening port of the Apache service
134 Listen 80 listens to port 80 of all IP addresses on the machine
Listen IP: the port number listens to the specific port of the specific IP address of the local machine.
You can use multiple Listen commands in Apache to flexibly configure multiple hosts and ports.
4. Set the relative root directory of Apache:
A. The relative root directory is the location where Aapache program files are stored, including configuration files and log files.
B. 57 ServerRoot "/etc/httpd"
5. Set the Apache log file:
A. Log Type: Error Log
Access log
B. Error Log: 471 ErrorLog logs/error_log
ErrotLog Error Log File Name
C. access log: 513 CustomLog logs/access_log combined
Mlog access log file name access log format
Access log format: common standard format, recognized by most log analysis tools
No)
Combined common extension)
The log format is defined by the 484 LogFormat command.
6. Set the Administrator address and the notification address when Apache fails.
250 ServerAdmin root @ localhost
7. Set the Host Name of the Apache service: the host name is resolved to DNS when Apache is started.
263 ServerName www.itatpro.com: 80
ServerName host FQDN: Port Number
ServerName IP: Port Number
3. Set the user's home directory permissions
304 <Directory "/var/www/html">
<Directory "User main Directory">
318 Options Indexes FollowSymLinks MultiViews
Option allows directory browsing to allow multiple views
-Indexes does not allow directory browsing
In multiple views, Apache automatically matches similar content and returns it to the client.
Number.
325 AllowOverride None (access to the. htaccess file in each directory is prohibited
Question Control)
330 Order allow, deny Access Control)
331 Allow from all
Order allowed, forbidden
Allow from all
Order priority 2, priority 1
Addresses allowed by allow from IP
Deny from IP Address Access prohibited
333 </Directory>
4. Create a virtual directory
1. virtual directory: it is an extension of the main directory. The virtual directory allows you to flexibly configure disk space.
2. Add a virtual directory:
Alias/virtual directory name/"actual location of virtual directory"
<Directory "actual location of the virtual Directory">
541 Options Indexes MultiViews
542 AllowOverride None
543 Order allow, deny
544 Allow from all
545 </Directory>
3. Absolute reference
Alias/virtual directory name (/) "/actual location of the virtual directory (/)"
V. Access Control
1. User Authentication
A. Create a password file and add a security account
# Htpasswd-c/password file storage location Security Account Name
-C: Create a password file
B. Configure the field for setting directory permissions for user authentication)
AuthType Basic user authentication type Basic Authentication)
AuthName "This is a security Site, Please Login :"
User Authentication content)
AuthUserFile/etc/httpd/passwd01 location of the User Password File)
Require user root tom)
Vi. VM
1. IP-based VM
A. Determine the Host IP Address:
Create Virtual Interface: # ifconfig eth0: 1 IP Address
B. Create an IP-based VM
<VirtualHost 192.168.16.252>
ServerName 192.168.16.252: 80 set the Host Name
ServerAdmin root@itat.com administrator email address
DocumentRoot "/www/itat" main directory
DirectoryIndex index.html homepage File
Errorlog logs/itat/error_log Error Log
Customlog logs/itat/access_log common access log
AuthType Basic
AuthName "This is a security Site, Please Login :"
AuthUserFile/etc/httpd/passwd01
Require user root tom
</VirtualHost>
2. Port-based VM
<VirtualHost *: 8081> (* indicates all IP addresses of the local machine)
ServerName 192.168.16.254: 8081
......
</VirtualHost>
3. All sites of a VM Based on Multiple host headers should be included in the VM settings)
A. Create a DNS resolution Structure
B. Create a VM Based on the Host Header
For example, set the public IP addresses of different host headers in NameVirtualHost 192.168.16.254)
<VirtualHost www.itat.com> the first virtual host is the default virtual host.
ServerName www.itat.com: 80 access from a Host Header not specified by Apache)
ServerAdmin root@itat.com
DocumentRoot "/www/itat"
DirectoryIndex index.html
Errorlog logs/itat/error_log
Customlog logs/itat/access_log common
</VirtualHost>
<VirtualHost www.baidu.com>
ServerName www.baidu.com: 80
ServerAdmin root@baidu.com
DocumentRoot "/www/baidu"
DirectoryIndex index.html
Errorlog logs/baidu/error_log
Customlog logs/baidu/access_log common
</VirtualHost>