02:httpd-2.2 Basic Configuration

Source: Internet
Author: User
Tags aliases ldap response code

---restore content starts---

9 , log Settings

error log:

Errorlog logs/error_log//The relative path is used here, relative to the/etc/httpd/path

LogLevel warn//Define the logging level, indicating the level at which this level is recorded, the higher log level will be recorded

Log levels: Debug, info, notice, warn, error, crit, alert, Emerg (default is Warn)

Access log:

Customlog Logs/access_log Combined//conbined is the log format, which is the following

Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combined

%H: Client IP address;

%l:remote logname (from Identd, if supplied). "-" indicates null;

%u:remote User login (from auth; can bogus if return status (%s) is 401) for basic or Digist authentication based on HTTPD protocol;

%t:time the request is received (standard Chinese format), the server receives the requested time;

%r:first Line of request, the first row of the requested message (method URL version);

%>s: Response status Code; Status code

%b: The size of the response message, in bytes, not including the header of the response packet;

%{referer}i: The value of the "Referer" header in the request message; The access entry for the current resource, that is, the hyperlink from which page jumps to, and the null representation of the Referer is typed directly from the browser, not from the hyperlink.

%{user-agent}i: The value of the "User-agent" header in the request message, i.e. the application to which the request was made;

Details:http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats

Example: 192.168.108.1--[31/may/2018:22:11:15 +0800] "get/http/1.1" 403 283 "-" "mozilla/5.0 (Windows NT 10.0; WOW64; trident/7.0; rv:11.0) Like Gecko "

Ten , Path aliases

DocumentRoot "/www/htocs"

http://www.magedu.com/download/bash-4.4.2-3.el6.x86_64.rpm

Path mapping:-->/www/htdocs/download/bash-4.4.2-3.el6.x86_64.rpm

alias/url/"/path/to/somedir/"//url is the original path, followed by the alias Path//alias refers to the access to a path, the path should be under the DocumentRoot, but is directed to another location:

Example:

#mkdir-pv/www/htdocs

#cd!$

#mkdir BBS

#vim/www/htdocs/bbs/index.html//For the BBS directory to create a page to add content page At/bbs, at this time in the page is inaccessible

#vim/etc/httpd/conf.d/httpd.conf//Modify

alias/bbs/"/forum/htdocs"//define BBS alias as/forum/htdocs

Http://www.magedu.com/bbs/index.html

The alias path is:-->/forum/htdocs/bbs//forum created under the root directory, which is not related to DocumentRoot.

One , set the default character set

Adddefaultcharset UTF-8//Set default character set

GBK, GB2312, GB18030//These 3 are GB Chinese character code

A , user-based access control Important

1, certification questions:

Www-authenticate: The response code is 401, rejecting the client request and stating that the customer is required to provide the account number and password;

2, certification:

Authorization: The client user fills in the account number and the password again sends the request message, the authentication passes, then the server sends the response the resource;

Authentication type:

Basic: Clear Text authentication

Digest: Message digest (encrypted by MD5)

Security Domain : A path that requires user authentication to be accessible;

It should be identified by name and used to inform the user of the reason for authentication;

Where is the user's account and password stored?

Virtual Account: The authentication logo used only to access a service;

storage ://Virtual Account Storage Place

Text file

SQL database

ldap//Lightweight Directory Access Protocol

Nis

Add a virtual host based on IP

First step: Add the configuration in the main configuration file of httpd first

#vim/etc/httpd/conf/httpd.conf//Add a configuration file for two virtual hosts on the last line of the main configuration file

<virtualhost 192.168.108.160:80>

ServerName web1.magedu.com

DocumentRoot "/vhosts/web1/htdocs"

</VirtualHost>

<virtualhost 192.168.108.161:80>

ServerName web2.magedu.com

DocumentRoot "/vhosts/web2/htdocs"

</VirtualHost>

#httpd-T or #service httpd configtest//Can see if the master profile syntax is correct

Step Two:

#mkdir/VHOSTS/{WEB1,WEB2,WEB3,WEB4}/HTDOCS-PV//DocumentRoot to add a virtual host

Step Three: Configure the access page for the virtual host

#vim/vhosts/web1/htdocs/index.html added: Page at Web1

#vim/vhosts/web2/htdocs/index.html added: Page at WEB2

Enter the URL 192.168.108.160/161 in the browser to access the

---restore content ends---

9 , log Settings

error log:

Errorlog logs/error_log//The relative path is used here, relative to the/etc/httpd/path

LogLevel warn//Define the logging level, indicating the level at which this level is recorded, the higher log level will be recorded

Log levels: Debug, info, notice, warn, error, crit, alert, Emerg (default is Warn)

Access log:

Customlog Logs/access_log Combined//conbined is the log format, which is the following

Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combined

%H: Client IP address;

%l:remote logname (from Identd, if supplied). "-" indicates null;

%u:remote User login (from auth; can bogus if return status (%s) is 401) for basic or Digist authentication based on HTTPD protocol;

%t:time the request is received (standard Chinese format), the server receives the requested time;

%r:first Line of request, the first row of the requested message (method URL version);

%>s: Response status Code; Status code

%b: The size of the response message, in bytes, not including the header of the response packet;

%{referer}i: The value of the "Referer" header in the request message; The access entry for the current resource, that is, the hyperlink from which page jumps to, and the null representation of the Referer is typed directly from the browser, not from the hyperlink.

%{user-agent}i: The value of the "User-agent" header in the request message, i.e. the application to which the request was made;

Details:http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats

Example: 192.168.108.1--[31/may/2018:22:11:15 +0800] "get/http/1.1" 403 283 "-" "mozilla/5.0 (Windows NT 10.0; WOW64; trident/7.0; rv:11.0) Like Gecko "

Ten , Path aliases

DocumentRoot "/www/htocs"

http://www.magedu.com/download/bash-4.4.2-3.el6.x86_64.rpm

Path mapping:-->/www/htdocs/download/bash-4.4.2-3.el6.x86_64.rpm

Aliases refer to a path, which should be under DocumentRoot, but is directed to a different location:

alias/url/"/path/to/somedir/"//url is the original path, followed by the alias path

Example:

alias/bbs/"/forum/htdocs"//define BBS alias as/forum/htdocs

Http://www.magedu.com/bbs/index.html

The alias path is:-->/forum/htdocs/bbs//forum created under the root directory, which is not related to DocumentRoot.

One , set the default character set

Adddefaultcharset UTF-8//Set default character set

GBK, GB2312, GB18030//These 3 are GB Chinese character code

A , user-based access control Important

1, certification questions:

Www-authenticate: The response code is 401, rejecting the client request and stating that the customer is required to provide the account number and password;

2, certification:

Authorization: The client user fills in the account number and the password again sends the request message, the authentication passes, then the server sends the response the resource;

Authentication type:

Basic: Clear Text authentication

Digest: Message digest (encrypted by MD5)

Security Domain : A path that requires user authentication to be accessible;

It should be identified by name and used to inform the user of the reason for authentication;

Where is the user's account and password stored?

Virtual Account: The authentication logo used only to access a service;

storage ://Virtual Account Storage Place

Text file

SQL database

ldap//Lightweight Directory Access Protocol

Nis

Add a virtual host based on IP

First step: Add the configuration in the main configuration file of httpd first

#vim/etc/httpd/conf/httpd.conf//Add a configuration file for two virtual hosts on the last line of the main configuration file

<virtualhost 192.168.108.160:80>

ServerName web1.magedu.com

DocumentRoot "/vhosts/web1/htdocs"

</VirtualHost>

<virtualhost 192.168.108.161:80>

ServerName web2.magedu.com

DocumentRoot "/vhosts/web2/htdocs"

</VirtualHost>

#httpd-T or #service httpd configtest//Can see if the master profile syntax is correct

Step Two:

#mkdir/VHOSTS/{WEB1,WEB2,WEB3,WEB4}/HTDOCS-PV//DocumentRoot to add a virtual host

Step Three: Configure the access page for the virtual host

#vim/vhosts/web1/htdocs/index.html added: Page at Web1

#vim/vhosts/web2/htdocs/index.html added: Page at WEB2

Enter the URL 192.168.108.160/161 in the browser to access the

02:httpd-2.2 Basic Configuration

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.