CentOS6.5 system build Apache server

Source: Internet
Author: User

CentOS6.5 system build Apache server

Apache is the world's No. 1 Web server software. It can run on almost all widely used computer platforms. Because of its wide use of cross-platform and security, it is one of the most popular Web server software.

There are multiple Apache working modes, of which two are most commonly used:

Prefork mode: PreforkMPM uses multiple sub-processes. Each sub-process has only one thread. Each process can maintain only one connection at a specified time.

On most platforms, the Prefork MPM is more efficient than the Worker MPM, but the memory usage is much larger. Prefork's wireless program design will be more advantageous in some cases than worker: it can use third-party modules that do not handle thread security well, and for platforms that have difficulty in thread debugging, it is easier to debug.

Worker mode: WorkerMPM uses multiple sub-processes. Each sub-process has multiple threads. Each thread can maintain only one connection at a specified time. Generally, on a high-traffic HTTP server, Worker MPM is a good choice, because the memory usage of Worker MPM is much lower than that of Prefork MPM.

The Worker MPM is also imperfect. If a thread crashes, the whole process will "die" together with all its threads ". because threads share memory space, a program must be recognized by the system as "Every thread is safe" during runtime ".

Environment:

CentOS 6.5 x86_64-minimal

Server IP: 172.16.11.168

cd ~ rpm-qa| grep httpd yumremoveraprapr-utilpcrehttpd-y yum-y install gccgcc-c++wget wget-chttp: //soft .vpser.net /web/apache/httpd-2 .4.12. tar .gz wget-chttp: //soft .vpser.net /web/apache/apr-1 .5.1. tar .gz wget-chttp: //soft .vpser.net /web/apache/apr-util-1 .5.4. tar .gz wget-chttp: //soft .vpser.net /web/pcre/pcre-8 .30. tar .gz tar -xzvfapr-1.5.1. tar .gz tar -xzvfapr-util-1.5.4. tar .gz tar -xzvfpcre-8.30. tar .gz tar -xzvfhttpd-2.4.12. tar .gz cd pcre-8.30 . /configure --prefix= /usr/local/pcre make && make install cd ~ /apr-1 .5.1 . /configure --prefix= /usr/local/apr make && make install cd ~ /apr-util-1 .5.4 . /configure --prefix= /usr/local/apr-util --with-apr= /usr/local/apr/bin/apr-1-config make && make install cd ~ /httpd-2 .4.12 . /configure --prefix= /usr/local/apache --with-apr= /usr/local/apr --with-apr-util= /usr/local/apr-util --with-pcre= /usr/local/pcre -- enable -so-- enable -modules=all--sysconfdir= /usr/local/apache/conf --with-pcre= /usr/local/pcre make && make install cd ~ /usr/local/apache/bin/apachectl start # Start Apache Note: When Apache is started, httpd: apr_sockaddr_info_get () failed is reported. for jacken httpd:Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using127.0.0.1 for ServerName This cannot be an error because it does not affect the normal operation of the service, but I am not happy to see it. Cause: ServerName is not set in httpd. conf. Solution: vim /usr/local/apache2/conf/httpd .conf cat /usr/local/apache2/conf/httpd .conf| grep ^ServerName ServerNamelocalhost:80 Add Apache boot auto start: 1. simplest method: echo "/usr/local/apache/bin/apachectl" >> /etc/rc .d /rc . local 2 ln -s /usr/local/apache/bin/apachectl /etc/rc .d /rc3 .d /S85httpd // Create soft link 3. Run chkconfig -- list and find that there is no httpd in the linux service list. Use chkconfig -- addhttpd to add it, but the prompt is: the httpd service does not support chkconfig. \ cp /usr/local/apache/bin/apachectl /etc/rc .d /init .d /httpd Edit /etc/rc .d /init .d /httpd To ** release information: # Chkconfig: 3458515 note: the added content includes #. #description:Apache The value of the three numeric parameters in the first line is as follows: Which Linux levels need to start httpd (3, 4, 5), the startup sequence number (85), and the shutdown sequence number (15 ). Save the file and run chkconfig -- addhttpd. The file is successfully added. The link file of S85httpd will appear in the rc3.d, rc4.d, and rc5.d paths, and the link file of K61httpd will appear in other running-level paths. Then you can use servicehttpdstart servicehttpdstop Servicehttpdrestart manages Apache services Verify that the Apache service is successfully installed. The attachment is a script for installing Apache. Note: The script is written on the WINDOWS platform. Use the command set Ff = unix converts the dos format to unix. Deleted. Why can't I delete the attachment after it is uploaded? In fact, I just want to upload it for a try. There are two parts to be modified: It is best to add the-c parameter for 1wget download. Otherwise, the source code package will not be available in most cases. I don't know why. For example, wget-chttp: //soft .vpser.net /web/apache/httpd-2 .2.4.12. tar .gz 2. When installing httpd, I forgot to associate the pcre. I did not associate the pcre during step-by-step installation and did not report an error. However, I do not know why it is necessary to associate the pcre with the script. Otherwise, an error will be reported. . /configure --prefix= /usr/local/apache --with-apr= /usr/local/apr --with-apr-util= /usr/local/apr-util --with-pcre= /usr/local/pcre -- enable -so-- enable -modules=all--sysconfdir= /usr/local/apache/conf 3. There are modifications in my downloads. The scripts are correct after verification.

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.