Linux Configuration www Server full raiders _linux

Source: Internet
Author: User
Tags web services apache log microsoft iis
the first station Apache history and Prospects
In 1995, the National Association of Computer Security (NCSA) developers created the NCSZ Global Network Service software, its biggest feature is the HTTP daemon, which is more easily configured and created by source code than the then CERN server, and because of the lack of other server software at that time, he quickly became popular. But then, almost all of the server's core developers left NCSA, and some users set up an organization to manage the patches they wrote, and Apache group came into being. They call the server software Apache. Apache originates from the pronunciation of a patchy server, meaning it is full of patches. Now Apache is slowly becoming the most popular Web server software on the Internet. Of all the Web server software, Apache is an absolute advantage, far ahead of the second-ranked Microsoft IIS. If you are interested in it, you can visit the official Apache website: http://www.apache.org. Apache as one of the free software, like other free software, they are a lot of free developers devote a great deal of time and effort to achieve and gradually improve, so we have reason to believe that the future of Apache is better.
the second station Apache 2.0 installation  
The Apache 2.0 configuration is very different from the installation and Apache 1.3, and he uses Libtool and autoconf to configure the environment like other Open-source software. But whether it's Apache, there are usually two ways to install: source code installation and RPM package installation. These two types of installation are unique, RPM package installation does not need to compile, and source code installation needs to be configured to install the installation, RPM package installed in a fixed location, select a fixed module, and source code installation allows you to choose the installation path, choose the module you want. The following two types of installation methods are described in the form of an instance.
First, use source code to install
(1) Access to source code
# Lynx HTTP://WWW.APACHE.ORG/DIST/HTTPD/HTTPD-2_0_NN.TAR.GZ
NN represents the version number that is currently in use.
(2) Decompression
# gzip-d Httpd-2_0_nn.tar.gz
# tar XVF Httpd-2_0_nn.tar
(3) configuration.
#./configure--prefix=/usr/local/apache
Indicates that Apache will be installed in the/usr/local/apache directory
(4) Compilation and installation
# make
# make Install
(5) test
#/usr/local/apache/bin/apachectl Start
two, use the RPM package installation
# RPM-IVH apache-*.rpm
When the installation is complete, the configuration file is in the/etc/httpd/conf/directory, the file root is/var/www/html, the tool file is in the/etc/rc.d/init.d/directory, and the log file is under the/var/log/httpd/directory.
The third station Apache 2.0 configuration
The primary configuration file for Apache 2.0 is httpd.conf. If the configuration file is stored in the/usr/local/apache/conf/directory with the above source code installation, the configuration file is saved in the/etc/httpd/conf/directory if the RPM package is installed. We can directly modify the httpd.conf file can also be configured with the Redhat Linux 9 with graphical tools. Open the Launcher-> system settings-> server settings->http server that can be related. The main interface as shown:
Let's take a look at a few of the instructions in httpd.conf, "#" and add a note.
Port #定义了web服务器的侦听端口, the default value is 80, which is one of the TCP network ports. If multiple ports are written, the last one is the same.
User Apache #一般情况下 to nobody users and nobody groups to run the Web server because the Web
All processes issued by the Group Apache # Server Run as root and have a security risk.
ServerAdmin root@localhost #指定服务器管理员的E-mail address. The server automatically reports errors to this address.
SERVERROOT/ETC/HTTPD #服务器的根目录, in general, all of the configuration files in this directory
ServerName new.host.name:80 #web客户搜索的主机名称
KeepAliveTimeout #规定了连续请求之间等待15秒, if exceeded, re-establish a new TCP connection
Maxkeepaliverequests #永久连接的HTTP请求数
MaxClients #同一时间连接到服务器上的客户机总数
ErrorLog Logs/error_log #用来指定错误日志文件的名称和路径
Pidfile run/httpd.pid #用来存放httpd进程号 to facilitate stopping the server.
Timeout #设置请求超时时间, if the net speed is slower then should set the value to be big.
Documentroot/var/www/html #用来存放网页文件
the fourth station Apache management
(1) Start and stop Apache
/ETC/RC.D/INIT.D/HTTPD start
/ETC/RC.D/INIT.D/HTTPD stop
(2) Apache log files
Some people say that deciding whether an administrator is a good one is to see if he is an expert at analyzing logs, because the feedback from the log file is very important to the administrator. Apache's day to file mainly includes access logs and error logs. The access log records the process of all requests by the server, mainly the customer information, through which we can know what people visit the site, when to visit, what the content is, and so on. The error log records the details of the server error and how it is handled. The location of the log file is specified by the above master configuration file, httpd.conf. Redhat has a tool for viewing logs--system logs. The main interface is as follows

Here's an example to illustrate his format:
The error log is spelled:
[Mon Sep 22 14:32:52 2003] [ERROR] [Client 127.0.0.1] client denied by server configuration:/export/home/live/ap/htdocs/test
[Mon Sep 22 14:32:52 2003] The time the error occurred.
[ERROR] Indicates the level of the error. With Debug,info,notice,warn,error,crit,alert,emerg, these levels indicate the severity of the error from low to high.
[Client 127.0.0.1] represents the clients IP address.
Client denied by server configuration:/export/home/live/ap/htdocs/test mark is the specific information of the error.
To access the log:
127.0.0.1-wangdong [22/sep/2003:13:55:36-0800] "Get/apache_pb.gif http/1.0" 200 2326
127.0.0.1 represents the client IP address that accesses this server.
Wangdong represents the user's login name.
[22/sep/2003:13:55:36-0800] Server completes client request time, in the format [day/month/year: Hours: minutes: seconds time Zone]
"Get/apache_pb.gif http/1.0" indicates the method used by the client to access the resource.
200 records the status code that the server returns to the customer. 200 indicates success, and an access error preceded by 4.
2326 represents the total number of bytes sent to the client. If "-" indicates that no access resources have been found.
However, in practical applications, for large Web sites, log files tend to grow quickly, not conducive to our query, reduce the efficiency of the server, and occupy a lot of disk space, so we have to regularly maintain the log.
Since the log files are large, how can we organize a lot of boring data into a form that we can easily understand? Is there such a tool? Luckily, Redhat Linux 9 came with a tool for analyzing logs--webalizer, as shown in the figure:
We can also find plenty of such excellent free tools on the Internet, such as WebTrends analysis Series.
Fifth Station configuration Virtual host
A virtual host provides WWW services for multiple separate domain names on a single WWW server. Each domain name has its own directory and configuration, the equivalent of a host into more than one host, the virtual host technology for the number of hosts, but also want to provide different users with independent Web services needs are very effective. For a company, it seems unwise to make use of expensive servers to provide only one domain name service, and now more and more companies like to use multiple domain name services on one server and set up different websites, the benefit of which is obvious.
Apache supports virtual hosts in two ways, one based on ip-based virtual hosts and the other based on the name of a virtual host. The virtual host based on the name uses the same IP address to configure different virtual hosts, which makes up for the problem caused by the insufficient IP address. The configuration of the name-based virtual host is fairly simple, you only need to configure your DNS server so that each host name corresponds to the correct IP address, and then configure Apache HTTP server so that it can recognize different host names.
Suppose we set up a multimedia production company with an Apache server and an IP address: 192.168.0.1 to run two kinds of business, one for e-commerce sites, domain names for www.business.media.com, and another for teaching websites, Domain name is www.teaching.media.com. First in the DNS server to the domain name www.business.media.com and www.teachin....conf on it.
Namevirtualhost 192.168.0.1
ServerName www.business.media.com
Documentroot/var/www/html/business

ServerName www.teaching.media.com
Documentroot/var/www/html/teaching
and ip-based virtual host requires the use of different IP addresses to distinguish between different virtual hosts, which requires the use of multiple network cards, different IP addresses bundled to different network cards, or on a network card bundled with multiple IP addresses. Suppose our host IP address is 192.168.0.1 (www.media.com), there are two additional IP addresses do not?.. Nf/httpd.conf. [/URL]
ServerAdmin webmaster@ business.media.com
Documentroot/var/www/html/business
ServerName www.business.media.com
Errorlog/var/www/html/business/logs/error_log
Transferlog/var/www/html/business/logs/access_log

ServerAdmin webmaster@teaching.media.com
Documentroot/var/www/html/teaching
ServerName www.teaching.media.com
Errorlog/var/www/html/teaching/logs/error_log
Transferlog/var/www/html/teaching/logs/access_log
Sixth station Configure Apache Proxy
Proxy Server is the transit point of Network Information service. If we put the Apache proxy server image as an agent, consumers buy things to agents, if agents have, can be sold directly to consumers, if not, the agent to the manufacturers purchase, and then sold to consumers. This has the following advantages: (1) increased access speed. (2) acts as the firewall, increases the security. (3) can filter some bad websites. (4) has caching function. (5) Save IP overhead. There are two types of proxy servers: client proxy and server-side proxy. Below we explain a few instructions to illustrate their own configuration methods.
Proxyrequest On/off #启用或者禁用Apache代理服务.
CacheRoot "/etc/httpd/proxy" #代理缓存的根目录.
CacheSize 5 #代理缓存的大小.
Cachegcinterval 4 #设定运行管理缓存的无用数据搜集程序的时间间隔
Cachemaxexpire #文件过期时间.
Cachedefaultexpire 1 #指定未包含过期信息文件的有效期.
NoCache a-domain.com another-domain.edu #该网站的文件将不被缓存.
L Client Agent Configuration
(1) Modify the relevant instructions in the/ETC/HTTPD/CONF/HTTPD.CONF
(2) Modify the/etc/httpd/conf/httpd.conf to add access control to the proxy directory.
Order Deny,allow
Deny from all
Allow from. your-domain.com
(3) Restart httpd.
L server-side proxy configuration
Unlike the client proxy, the server-side agent installs the Apache server on the firewall and uses it to provide proxy access to the WWW server. This method separates the WWW server from the outside and improves security, but it seems to be unchanged for the user. Assuming that the WWW server's IP address is 192.168.0.2 in the internal LAN, the firewall host has an internal IP address of 192.168.0.5 and an external IP address of 192.9.202.1.
(i) Configure Apache on the firewall
(1) Add a virtual host to the/etc/httpd/conf/httpd.conf.
ServerAdmin webmaster@business.media.com
Documentroot/www/docs/business.media.com
ServerName www.business.media.com
ErrorLog Logs/business.media.com-error_log
Customlog Logs/business.media.com-log_common
(2) Configure the DNS server in the LAN to point the www.business.media.com to 192.9.201.1.
(ii) Configuring the local area network www server
In the Linux environment, there is a very popular proxy server software--squid. His function is very powerful, support Http,ftp,gopher,ssl, and WAIS, and other protocols agent, and the setup is simple, just a little change in the configuration file can be.
Well, www server configuration This road is finally gone, I hope that read this article can have some harvest, and finally, hope in learning Linux This is full of fun and covered with thorns on the road enthusiasts, never say die, become a real master.
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.