RedHat6.2 server configuration solution (2): Apache

Source: Internet
Author: User
Article Title: RedHat6.2 server configuration solution (2): Apache. 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.
Author: Tang haijing
  
Chapter 2 Apache
2.1 Introduction
Apache is the world's top Web server. According to Netcraft, a famous Web server survey company, more than 50% of the world's Web servers are using Apache.
  
Apache provides a variety of functions for our network administrators, including Directory Index, directory alias, content negotiation, configurable HTTP Error Report, SetUID execution of CGI program, sub-process resource management, server-side image ing, URL rewriting, URL spelling check, and online manual man. That is to say, if you have successfully installed and configured Apache on the Linux Server, your computer will also change as Apache takes effect and become a real Web Server, this change is indeed exciting. Along with the power of free software development, we have reason to believe that the future of Apache is bright.
  
In the Internet era, the release of external homepage has become an important means to establish the company's image, and the internal homepage has become the main method of company management. However, to implement these functions, we should first configure our Linux Server as a powerful Web Server. Apache is the most widely used Web server software today. This chapter describes how to configure Apache servers. I hope that my colleagues can read this article to achieve the goal of both theoretical practices and quickly become an outstanding network administrator in a short time.
  
2.2 Required System Resources
2.2.1 configuration file:
  
File Source
  
/Etc/httpd/conf/httpd. conf apache-1.3.12-2.i386.rpm
  
/Etc/httpd/conf/access. conf apache-1.3.12-2.i386.rpm
  
/Etc/httpd/conf/srm. conf apache-1.3.12-2.i386.rpm
  
2.2.2 related tools:
  
File Source
  
/Etc/rc. d/init. d/httpd apache-1.3.12-2.i386.rpm
  
2.3 configuration Scheme
There are three files related to Apache configuration:
  
/Etc/httpd/conf/httpd. conf main configuration file
  
Purpose: Define the setting value of the HTTP protocol and the operations on the server, and define the directories of the three files.
  
Instance:
  
ServerType standalone
  
# Define the WebServer startup method as standalone to enhance its responsiveness to a large number of accesses in a timely manner
  
ServerRoot "/etc/httpd"
  
# Specify the directory containing 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
  
# Minimum number of idle server processes to be retained
  
MaxSpareServers 20
  
# Maximum number of idle server processes to be retained
  
StartServers 8
  
# Number of daemon processes at system startup
  
MaxClients 150
  
# The maximum client number that can provide services. Parts greater than this number are 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_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
  
# Define the TCP port number used by the server
  
User nobody
  
Group nobody
  
# The above two rows are the file permissions assigned to the new users of httpd, and their permissions are set to the lowest for security reasons.
  
ServerAdmin root @ localhost
  
# Set the email address of the Web administrator
  
ServerName thj
  
# Define the host name returned to the client when the client reads data from the server. The default value is localhost.
  
DocumentRoot "/home/httpd/html"
  
# Set the root directory of all documents provided by Apache. For example, if a user requests a request for www.mycompany.com/index.html, the response of apacheto the response is as follows: /home/httpd/html/index.html
  
UserDir public_html
  
DirectoryIndex index.html index.htm index.shtml index. cgi
  
# Set multiple methods for successfully accessing the home page to improve system fault tolerance
  
AccessFileName. htaccess
  
UseCanonicalName On
  
TypesConfig/etc/mime. types
  
DefaultType text/plain
  
HostnameLookups Off
  
ErrorLog/var/log/httpd/error_log
  
LogLevel warn
  
# Define which error types are recorded in the error log
  
LogFormat "% h % l % u % t \" % r \ "%> s % B \" % {Referer} I \ "\" % {User-Agent} I \ "" combined
  
# All logformats are used to define entries in logs.
  
LogFormat "% h % l % u % t \" % r \ "%> s % B" common
  
LogFormat "% {Referer} I-> % U" referer
  
LogFormat "% {User-agent} I" agent
  
CustomLog/va
Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.