In the Internet age, the release of external home page has become an important means to establish the image of the company, and Internal homepage has become the main way of corporate governance. However, to implement these features, you should first configure our Linux server as a powerful Web server. This chapter describes in detail how to configure the Apache server. I hope that colleagues will be able to read this article to achieve the theoretical practice of double harvest, in a very short time quickly become an excellent network administrator.
1.2 Resource requirements
1.2.1 Required Package
RedHat6.2 Server Installation
1.2.2 Required configuration Files
/etc/httpd/conf/httpd.conf system with self, admin configuration
/etc/httpd/conf/access.conf system with no need to modify
/etc/httpd/conf/srm.conf system with no need to modify
1.3 Configuration Scheme
/etc/httpd/conf/httpd.conf
Description: Apache Main configuration file
Source file:
ServerType Standalone
# define webserver startup as standalone to enhance its responsiveness to massive access
ServerRoot "/ETC/HTTPD"
# Specifies the directory containing the HTTPD server files
Lockfile/var/lock/httpd.lock
Pidfile/var/run/httpd.pid
Scoreboardfile/var/run/httpd.scoreboard
Timeout 300
# response timeout, in seconds
KeepAlive on
# allow users to establish permanent connections
Maxkeepaliverequests 100
KeepAliveTimeout 15
Minspareservers 5
# The minimum value of the free server process to keep
Maxspareservers 20
# The maximum number of idle server processes to keep
Startservers 8
# Number of Daemons during system startup
MaxClients 150
# The maximum client number that can provide a service, greater than its part is placed in the request queue
Maxrequestsperchild 100
LoadModule Vhost_alias_module modules/mod_vhost_alias.so
LoadModule Env_module modules/mod_env.so
LoadModule Config_log_module modules/mod_log_config.so
LoadModule Agent_log_module modules/mod_log_agent.so
LoadModule Referer_log_module modules/mod_log_referer.so
LoadModule Mime_module modules/mod_mime.so
LoadModule Negotiation_module modules/mod_negotiation.so
LoadModule Status_module modules/mod_status.so
LoadModule Info_module modules/mod_info.so
LoadModule Includes_module modules/mod_include.so
LoadModule Autoindex_module modules/mod_autoindex.so
LoadModule Dir_module modules/mod_dir.so
LoadModule Cgi_module modules/mod_cgi.so
LoadModule Asis_module modules/mod_asis.so
LoadModule Imap_module modules/mod_imap.so
LoadModule Action_module modules/mod_actions.so
LoadModule Userdir_module modules/mod_userdir.so
LoadModule Alias_module modules/mod_alias.so
LoadModule Rewrite_module modules/mod_rewrite.so
LoadModule Access_module modules/mod_access.so
LoadModule Auth_module modules/mod_auth.so
LoadModule Anon_auth_module modules/mod_auth_anon.so
LoadModule Db_auth_module modules/mod_auth_db.so
LoadModule Digest_module modules/mod_digest.so
LoadModule Proxy_module modules/libproxy.so
LoadModule Expires_module modules/mod_expires.so
LoadModule Headers_module modules/mod_headers.so
LoadModule Usertrack_module modules/mod_usertrack.so
LoadModule Setenvif_module modules/mod_setenvif.so
LoadModule Perl_module modules/libperl.so
LoadModule Php3_module modules/libphp3.so
Clearmodulelist
Addmodule MOD_VHOST_ALIAS.C
Addmodule mod_env.c
Addmodule mod_log_config.c
Addmodule mod_log_agent.c
Addmodule mod_log_referer.c
Addmodule mod_mime.c
Addmodule MOD_NEGOTIATION.C
Addmodule MOD_STATUS.C
Addmodule mod_info.c
Addmodule mod_include.c
Addmodule mod_autoindex.c
Addmodule mod_dir.c
Addmodule MOD_CGI.C
Addmodule MOD_ASIS.C
Addmodule mod_imap.c
Addmodule MOD_ACTIONS.C
#AddModule mod_speling.c
Addmodule mod_userdir.c
Addmodule MOD_ALIAS.C
Addmodule mod_rewrite.c
Addmodule MOD_ACCESS.C
Addmodule mod_auth.c
Addmodule MOD_AUTH_ANON.C
Addmodule MOD_AUTH_DB.C
Addmodule mod_digest.c
Addmodule mod_proxy.c
Addmodule MOD_EXPIRES.C
Addmodule MOD_HEADERS.C
Addmodule MOD_USERTRACK.C
Addmodule mod_so.c
Addmodule MOD_SETENVIF.C
Addmodule MOD_PERL.C
Addmodule mod_php3.c
Port 80
# defines the TCP port number used by the server
User Nobody
Group Nobody
# The above two lines are the file permissions assigned to the new user of httpd, for security reasons
Their permissions are set to a minimum.
ServerAdmin
# Set the Web administrator's e-mail address
ServerName Weboa
# defines the host name that is returned to the client when the client reads data from the server, and its default value
It's localhost, the first time you install Linux, it often goes wrong here.
DocumentRoot "/home/weboa/jakarta-tomcat/webapps/weboa"
# Set the root directory of all Apache documents, for example, the user
The access request, Apache on it
The response is/home/weboa/jakarta-tomcat/webapps/weboa/index.html
Options FollowSymLinks
AllowOverride None
Options Indexes Includes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all # allows all people to access
Userdir public_html
DirectoryIndex index.html index.htm index.shtml index.cgi
# set up a variety of ways to successfully access the home page in order to improve system fault tolerance
Accessfilename. htaccess
Order Allow,deny
Deny from all
Usecanonicalname on
Typesconfig/etc/mime.types
DefaultType Text/plain
Mimemagicfile Share/magic
Hostnamelookups off
Errorlog/usr/httpd/log/error_log
LogLevel warn
# define those types of errors that are logged in the error log
Logformat "%h%l%u%t \%r\"%>s%b \ "%{referer}i\" \ "%{user-agent}i\" "combined
# All Logformat are used to define entries in the log
Logformat "%h%l%u%t \"%r\ "%>s%b" common
Logformat "%{referer}i->%u" Referer
Logformat "%{user-agent}i" Agent
Customlog/usr/httpd/log/access_log Common
Serversignature on
alias/icons/"/home/httpd/icons/"
#定义目录与系统目录的对应关系
Options Indexes MultiViews
AllowOverride None
Order Allow,deny
Allow from all
scriptalias/cgi-bin/"/home/httpd/cgi-bin/"
#定义CGI目录
AllowOverride None
Options execcgi
Order Allow,deny
Allow from all
Indexoptions fancyindexing
Addiconbyencoding (cmp,/icons/compressed.gif) x-compress X-gzip
Addiconbytype (txt,/icons/text.gif) text/*
Addiconbytype (img,/icons/image2.gif) image/*
Addiconbytype (snd,/icons/sound2.gif) audio/*
Addiconbytype (vid,/icons/movie.gif) video/*
Addicon/icons/binary.gif. bin. exe
Addicon/icons/binhex.gif. hqx
Addicon/icons/tar.gif. Tar
Addicon/icons/world2.gif. wrl. wrl.gz. vrml. Vrm. IV
Addicon/icons/compressed.gif. Z. tgz. gz. zip
Addicon/icons/a.gif. ps. ai. eps
Addicon/icons/layout.gif. html. shtml. htm. pdf
Addicon/icons/text.gif. txt
Addicon/icons/c.gif. C
addicon/icons/p.gif. pl. py
Addicon/icons/f.gif. For
Addicon/icons/dvi.gif. DVI
Addicon/icons/uuencoded.gif. UU
Addicon/icons/script.gif. Sh. Shar. csh. Ksh. tcl
Addicon/icons/tex.gif. Tex
Addicon/icons/bomb.gif Core
Addicon/icons/back.gif..
Addicon/icons/hand.right.gif README
Addicon/icons/folder.gif ^^ directory^^
Addicon/icons/blank.gif ^^ blankicon^^
Defaulticon/icons/unknown.gif
Readmename README
Headername HEADER
AddEncoding x-compress Z
AddEncoding X-gzip GZ tgz
AddLanguage en. en
AddLanguage Fr. fr
AddLanguage de. de
AddLanguage da. Da
AddLanguage el. El
AddLanguage it. it
Languagepriority en fr de
AddType application/x-httpd-php3. php3
AddType Application/x-httpd-php3-source. Phps
alias/doc//usr/doc/
Order Deny,allow
Deny from all
Allow from localhost
Options Indexes FollowSymLinks
Include/etc/httpd/conf/tomcat-apache.conf
Alias/netcard "/home/weboa/jakarta-tomcat/webapps/weboa/net_card"
Options Indexes FollowSymLinks
Allow from all
CacheSize 5
# defines the buffer size, in kilobytes. Can be set according to your needs and the size of your hard disk space
Cachegcinterval 4
# Check the cache every 4 hours and delete files if they are over cachesize
Cachemaxexpire 24
#http files are kept for up to 24 hours
Cachelastmodifiedfactor 0.1
# define HTTP file expiration period, the default is 0.1, meaning that the expiration period = from the last modified time x, such as the time from the most recent modification is 5 hours, then the expiration period is 5x0.1=0.5 hours
Cachedefaultexpire 1
# This instruction provides a default time (hours) to destroy cached files, and the last change time for these files is not known. The Cachemaxexpire command does not override this setting
# # Below is how to access a directory control method # # Add the following in/etc/httpd/conf/httpd.conf:
alias/weboa/"/home/weboa/"
Options Indexes MultiViews
AllowOverride authconfig
Order Allow,deny
Allow from all
Create a. htaccess file in the/home/weboa directory
AuthName "Shared Files"
AuthType Basic
authuserfile/etc/httpd/conf/passwd
Require Valid-user
Execute commands to generate authentication files in the/etc/httpd/conf directory
Htpasswd-c thj thj #创建认证文件和第一个名和密码
HTPASSWD Weboa Weboa #添加其他用户名和密码
### The following is the implementation method ###
The following elements need to be added to the/etc/httpd/conf/httpd.conf:
alias/webadmin/"/home/weboa/webadmin/html/"
Options Indexes MultiViews
AllowOverride None
Order Allow,deny
Allow from all
Namevirtualhost 192.168.0.1 #虚拟域名的DNS服务器
ServerAdmin #网管邮件地址
documentroot/home/weboa/webadmin/html/#服务器页面目录
ServerName webadmin.weboa.com.cn #服务器名称
What you need to add to the/var/named/name2ip.conf:
WebAdmin in A 192.168.0.1
1.4 Testing and management measures
1.4.1 test method
Each time an administrator changes the settings of Apache, the/etc/rc.d/init.d/httpd restart should be executed to make the changes take effect.
1.4.2 Management method
Apache provides a large number of log files, and when Apache fails, the administrator can diagnose them according to the path defined by the errorlog in htppd.conf. The specific methods are:
Tail-f/var/log/httpd/apache/error_log
(Author: Tonghaiging)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.