Apache installation and use of
Author: zccst
Theory Chapter
1 , Apache Brief Introduction
Apache from the "a patchy server" pronunciation, meaning that the server is full of patches, because it is free software, so constantly someone to develop new features for it, new features, modify the original defects. Apache features simple, fast, stable performance, and can be used as a proxy server.
2 , Apache The working principle
Common server programs are Apache; Common client programs are browsers (ie, Netscape, Mozilla). We can access the Web page by entering a Uniform Resource Locator address (URL) in the browser's address bar. The most basic concept of the Web is hypertext (hypertext). It makes the text no longer the traditional page text, but instead jumps from one page position to another during the reading process. The language used to write Web pages is called Hypertext Markup Language, or HTML. The WWW service complies with the HTTP protocol, the default TCP/IP port is 80, and the client-server communication process is summarized as follows:
(1) the client (browser) and the Web server establish a TCP connection, and after the connection is established, an access request (such as Get) is made to the Web server. According to the HTTP protocol, the request contains a range of information such as the IP address of the client, the type of browser, and the URL of the request.
(2) When a Web server receives a request, the page content requested by the client is returned to the client. If an error occurs, the error code is returned.
(3) Disconnect from the remote Web server.
Practice Article
First step: Install.
Tar httpd-2.2.11.tar.gz
CD httpd-2.2.11
./configure--prefix=/opt/apache
Make
Make install
Note: If you are using Redhat, create a symbolic connection from/opt/apache/bin/apachectl to/ETC/RC.D/INIT.D/HTTPD
Ln-s/opt/apache/bin/apachectl/etc/rc.d/init.d/httpd
Step Two: Configure.
1, create the/opt/wwwroot folder
Mkdir/opt/wwwroot
Vi/opt/wwwroot/index.html
After the save exits.
2, modify the main configuration file httpd.conf, directory path is:/opt/apache/conf/httpd.conf
(1) User Apache
Group Apache
(2) DocumentRoot "/opt/wwwroot"
(3) <directory "/opt/wwwroot" >
(4) Remove the # Number of servername www.example.com:80 front
3, Permission modification
Useradd Apache
Chown-r apache:apache/opt/wwwroot/
Chown-r Apache:apache/opt/apache
Step Three: Test whether the installation was successful.
1, start Apache
/opt/apache/bin/apachectl start
Use Ps–ef|grep httpd or netstat–ln|more to view process status.
Note: If you are using a redhat, you can also use
/ETC/RC.D/INIT.D/HTTPD start
/ETC/RC.D/INIT.D/HTTPD stop
/ETC/RC.D/INIT.D/HTTPD restart
2, in the browser input native IP, visible installation is successful.
3, Stop and reboot
Stop:/opt/apache/bin/apachectl stop
Reboot:/opt/apache/bin/apachectl Restart
Report:
HTTPD = Hyper text Transfer Protocol Daemon "meter" hyper-Text Transfer Protocol resident program
HTTPD is the main program for the Apache Hypertext Transfer Protocol (HTTP) server. is designed as a stand-alone background process, which creates a pool of child processes or threads that process requests.
Typically, httpd should not be called directly, but in a Unix-like system called by Apachectl, run as a service in Windows nt,2000 and XP, and run as a command window in Windows 9x and me.
Finally, if combined with PHP, you need to modify the main configuration file, the specific changes to see the text.