httpd-2.2 and httpd-2.4 Installation deployment

Source: Internet
Author: User
Tags myadmin

httpIntroduction

httpd is the main program for the Apache Hypertext Transfer Protocol (HTTP) service. is designed as a stand-alone background process that creates a pool of child processes or threads that process requests

Process for a complete HTTP request

(1) Establishing or processing connections

(2) Receiving requests

(3) Processing requests

(4) Access to resources

(5) Building response messages

(6) Send Response message

(7) recorded in the log

HTTP protocol Request method

  • GET Requests the specified page information and returns the resource principal

  • HEAD is similar to a GET request except that there is no specific content in the response returned to get the HTTP header

  • POST submits form data to the specified server for processing requests. The request message principal species contains the content of the data information to be passed. a POST request may result in the creation of new resources and / or modification of existing resources.

  • PUT a data resource that uploads from the client to the server to replace the contents of the specified document.

  • the delete request server deletes the specified resource.

  • The Connect http/1.1 protocol is reserved for proxy servers that can change connections to pipelines.

  • The OPTIONS allows clients to view server performance.

http Protocol Response

The HTTP response is also made up of three parts, namely the status line, the message header, the response body

1, the status line format is as follows
Http-version Status-code Reason-phrase

whichHttp-versionrepresents the serverHTTPversion of the ProtocolStatus-coderepresents the response status code sent back by the serverReason-phraserepresents a text description of the status code.
The status code has three digits that make up the first number defines the category of the response and has five possible values
1xxinstruction Information--indicates that a request has been received to continue processing
2xxSuccess--indicates that the request has been successfully received, understood, accepted
3xx redirect--further action is required to complete the request
4xxClient Error--request has a syntax error or the request is not implemented
5xxserver-side error--the server failed to implement a legitimate request
common status codes, status descriptions, descriptions
$ OK//Client Request succeeded
Request//the client request has a syntax error that cannot be understood by the server
401 Unauthorized//request Unauthorized This status code must andWww-authenticateheader fields used together
403 Forbidden//The server receives the request but refuses to provide the service
404 Not Found//Request resource does not existegThe error is entered.Url
Internal Server Error//Unexpected error occurred on server
503 Server Unavailable//the server is currently unable to process client requests and may return to normal after a period of time

httpdfeatures

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/84/6B/wKioL1eQWa7g_NLDAAKBnZ3RprQ860.png-wh_500x0-wm_3 -wmp_4-s_317013739.png "title=" 4444.png "alt=" Wkiol1eqwa7g_nldaakbnz3rprq860.png-wh_50 "/>


httpdFunctional Characteristics
  • CGI (Common Gateway Interface)

  • Virtual Host

    • based on Ip

    • based on PORT

    • based on HOSTNAME

  • Reverse Proxy

  • Load Balancing

  • Path aliases

  • A rich user authentication mechanism

    • Basic

    • Digest

  • Support for third-party modules

httpd-2.2 Virtual Host configuration

CentOS 6 httpd-2.2 version provided by default

HTTPD Installation

Yum–y Install httpd

View httpd installation or not

[Email protected] ~]# Rpm-qa | grep httpdhttpd-2.2.15-54.el6.centos.x86_64httpd-tools-2.2.15-54.el6.centos.x86_64

View httpd installation path

[Email protected] conf.d]# RPM-QL httpd | less/etc/httpd/etc/httpd/conf//httpd configuration file path/etc/httpd/conf.d//httpd profile path/etc/httpd/conf.d/readme/etc/httpd/ Conf.d/welcome.conf/etc/httpd/conf/httpd.conf/etc/httpd/conf/magic/etc/httpd/logs//httpd log file path/etc/httpd/ Modules//httpd Module path/ETC/HTTPD/RUN/ETC/LOGROTATE.D/HTTPD/ETC/RC.D/INIT.D/HTCACHECLEAN/ETC/RC.D/INIT.D/HTTPD// HTTPD's service file/etc/sysconfig/htcacheclean/etc/sysconfig/httpd/usr/lib64/httpd/usr/lib64/httpd/modules/usr/lib64/ Httpd/modules/mod_actions.so/usr/lib64/httpd/modules/mod_alias.so

Configuring a virtual Host

[[email protected] conf]# grep "^namevirtualhost"/etc/httpd/conf/httpd.confnamevirtualhost 192.168.99.61:80

Configure HTTPD Basic Authentication to add httpd authenticated users

Htpasswd-c-m/etc/httpd/conf/.htpasswd tomhtpasswd-m/etc/httpd/conf/.htpasswd jerryhtpasswd-m/etc/httpd/conf/. HTPASSWD Mary

You can also configure httpd of the Basic Group-based authentication

Vim/etc/httpd/conf/.htgrpmygrps:user1 User2

Virtual Host Configuration

vim/etc/httpd/conf.d/vhost1.conf<virtualhost 192.168.99.61:80>    documentroot/ data/vhosts/www1/wordpress     servernamewww1.runner.vip     errorloglogs/www1.runner.vip-error_log    customloglogs/www1.runner.vip-access_log  common    <location/server-status>         sethandlerserver-status        authtypebasic         authname "For administrators"         authuserfile  "/etc/httpd/conf/.htpasswd"         #AuthGroupFile   "/ Etc/httpd/conf/.htgrp "         #Requiregroup  mygrps         requireuser tom user2   </location></ Virtualhost>

Open Httpds Support , need to install Mod_ssl Module

See if the installation SSL

httpd-m | grep sslyum–y install Mod_ssl[[email protected] conf]# httpd-m | grep sslssl_module (Shared)
HttpdsConfiguration
[[Email protected] ssl]# (umask 077; OpenSSL genrsa-out httpd.key 2048) generating RSA private key, 2048 bit long modulus. ..............+++..........+++

Generate a Certificate signing request

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/84/6B/wKioL1eQWDzRfR15AAMVvAEAuQM444.png-wh_500x0-wm_3 -wmp_4-s_3373042246.png "title=" 1111.png "alt=" Wkiol1eqwdzrfr15aamvvaeauqm444.png-wh_50 "/>

CA Server signing Certificate

[[Email protected] ca]# openssl ca -in /tmp/httpd.csr-out /etc/pki/ca/certs /httpd.crt -days 365using configuration from/etc/pki/tls/openssl.cnfcheck that  the request matches the signaturesignature okcertificate details:        Serial Number: 1  (0x1)         Validity           not before: jul 21  04:15:40 2016 GMT           Not  after : jul 21 04:15:40 2017 gmt        subject:           countryname                = CN            stateorprovincename       =beijing            organizationname          =  Runner           organizationalUnitName     = ops            commonname                 =  myadmin.runner.vip           emailaddress               [email protected]        X509v3 extensions:            X509v3 Basic Constraints:                  ca:false           netscape comment:                  OpenSSL  generated certificate           x509v3  subject key identifier:                 3D:63:98:25:9D:9E:6E:AD:87:58:4E:6B:82:AE:90:AE:DE:77:18:B7            X509v3 Authority Key Identifier:                 keyid:9b:65:f4:88:e7:a7:10:0f :82:7c:1a:ab:40:83:e3:5a:ae:ca:72:0e certificate is to be certified until  jul 2104:15:40 2017 gmt  (365 days) sign the certificate? [y/n]:y1  Out of 1 certificate requests certified,commit? [y/n]yWrite out database with 1 new  entriesdata base updated

virtual host 2

/etc/httpd/conf.d/ssl.conf  Main Configuration  loadmodule ssl_module modules/mod_ssl.solisten 443 <virtualhost _default_:443>documentroot "/data/vhosts/myadmin" Servername myadmin.runner.vip : 443errorlog logs/ssl_error_logtransferlog logs/ssl_access_log<directory "/data/vhosts/myadmin" >       Options None        allowoverride none       ## #禁止192.168.99.51 Access First approach          #Order  deny,allow        #Deny  from  192.168.99.51       ## #禁止192.168.99.51 access to the second approach         Order allow,deny       Allow from all        deny from 192.168.99.51</directory>sslcertificatefile  /etc/httpd/ssl/httpd.crtsslcertiFicatekeyfile /etc/httpd/ssl/httpd.key 

Access the MYADMIN.RUNNER.VIP test

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/84/6B/wKioL1eQWWHhWr47AAOY1XukZSY374.png-wh_500x0-wm_3 -wmp_4-s_2755498951.png "style=" Float:none; "title=" 2222.png "alt=" Wkiol1eqwwhhwr47aaoy1xukzsy374.png-wh_50 "/>

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/84/6B/wKiom1eQWWHTd3iuAAHbua9gH98290.png-wh_500x0-wm_3 -wmp_4-s_2518898876.png "style=" Float:none; "title=" 3333.png "alt=" Wkiom1eqwwhtd3iuaahbua9gh98290.png-wh_50 "/>


This article from "Fan tea" blog, declined reprint!

httpd-2.2 and httpd-2.4 Installation deployment

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.