Linux http service, APACHE

Source: Internet
Author: User

1. Basic knowledge

HTTP: Hypertext Transfer Protocol, hyperlink
Uri:uniform Resource Identifier, global scoped unique name
Mime:multipurpose Internet Mail Extension, multi-purpose Internet Message extension
The non-textual data is re-encoded into a text file before transmission, and the receiver can revert it back to its original format in the opposite way, and can also invoke the appropriate program to open the file

Dynamic Web page: server-side stored document non-HTML format, but programming language development script, according to the browser's address, attribute parameters (Get/post, etc.), the script accepts the parameters after the server execution, after the completion of the production of HTML-formatted documents.

Ip:
Source IP
Destination IP
Tcp:
Source Port
Destination Port
HTTP Header:
Get/2.html
Host:www.magedu.com (available for web hosting, only domain name)

HTTP message:
Request message
<method><request-URL><version>

Blank lines are required
<entity-body>//Message body

get/http/1.1
Host:www.magedu.com
Connection:keep-alive

Response message
<version><status><respon-phrase>

Blank lines are required
<entity-body>//Message body

http/1.1 OK
x-powered-by:php/5.2.1
Vary:accept-encoding,cookie,user-agent
Cache-control:max-age=3,must-revalidate
Content-encoding:gzip
content-length:6931

Status code:
1XX: Pure Information
2XX: Success Class
3XX: redirect
4XX: Error class information (client)
5XX: Error class information (server side)

Main operations of the Web server
1. Establish the connection
2. Receiving requests
3. Processing requests
4. Access to resources
5. Build response
6. Send Response
7. Record Log



http/1.1
HTTP Method
Get,head,post,put,delete,trace,options,connection

Apache:
Ncsa,httpd
A Patchy Server = Apache

Fsf:gun,gpl
Asf:apache Software Foundation
Web:httpd
Tomcat
Hadoop

httpd
Web Server,open Source
To create a process beforehand:
Maintenance of appropriate processes on demand
Modular design, the core is relatively small, various functions are added through the module (can be compiled separately, can be configured at runtime)
Support multiple ways of virtual host configuration
Socket Ip:port
Virtual Host: A physical server, Web program only one, Web programs can serve multiple different sites
IP-based virtual host
Port-based virtual host
Domain-based virtual host

Method for client Request message:
Method URL Version
Header

Body


Httpd:selinux (implemented to put it in permissive)
[Email protected] ~]# Getenforce
Disabled

Permanent entry into force Vi/etc/sysconfig/selinux



/USR/SBIN/HTTPD (Mpm:prefork)
Httpd:root,root (ports less than 1024 must be started by an administrator)
Httpd:apache,apache (Work process)

/etc/rc.d/init.d/httpd
Port: (80/TCP), (SSL:443/TCP)
/ETC/HTTPD: Working root directory
Master configuration file: httpd.conf
/etc/httpd/conf.d/*.conf
/etc/httpd/modules: various module paths
/etc/httpd/logs:--->/var/log/httpd: Log directory
There are two types of log files: Access log access_log, error log Err_log
/var/www
HTML: Access path to a static page
Cgi_bin: Access path for dynamic pages
Cgi:common Gateway Interface, invoking this Protocol (CGI), the Web server initiates a program that handles dynamic content and then gets the returned results.
Client---> httpd (index.cgi)--->spawn process (index.cgi), executes--->httpd--->client

FastCGI

Dynamic separation: Web server, return static content, application server, return content

http://10.160.65.44/manual/
Install httpd-manaual, and then generate the/etc/httpd/conf.d/manual.conf configuration file

Mpm:multi Path Modules
Mpm_winnt
Prefork (a request with a process response)
Worker (one request responds with one thread, starts multiple processes, each process produces multiple threads, multiple threads can share a process resource, but locks are involved)
Event (one process handles multiple requests)

Modify Startup mode: VI/ETC/SYSCONFIG/HTTPD

The URL path is not the same as the local file system path, and the URL is relative to the DocumentRoot path.

Options:
None: No options are supported
Indexes: Allow index directory (site must not allow, list all files)
Followsynlinks: Allow Web pages to access the file that the symbolic link points to
EXECCGI: Allow CGI scripts to be executed
MultiViews: Multi-view, international website, different regions display different languages

2. Web site needs to provide user name password access

Modifying a configuration file/etc/httpd/conf/httpd.conf

# AllowOverride Controls what directives is placedinch. htaccess files.# It can be" All","None", or any combination of the keywords:# Options FileInfo authconfig limit## allowoverride None allowoverride Authconfig authtype Basic authname  "Restricted Site ... " AuthUserFile " /etc/httpd/conf/htpasswd " Require valid-user

To create a authuserfile file with the HTPASSWD command:

[[email protected] conf]# htpasswd-c-m/etc/httpd/conf/htpasswd hadoop    //-c Create a new file-   m password to MD5 way to store new Password:re- for user hadoop[[email protected] conf]# htpasswd  -m/etc/httpd/conf /htpasswd tomnew password:re-forcat  htpasswd Hadoop: $apr 1$ Sktxz ... $be 6hoavgrdzncp4wgarie.tom: $apr 1$gdws0/. $kO 9sit77r9caax4hiyvdx0

The user name and password are required for this access.

Linux http service, APACHE

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.