Nginx installs the echo module and nginxecho module.

Source: Internet
Author: User

Nginx installs the echo module and nginxecho module.

1. download the required echo Module
Https://github.com/openresty/echo-nginx-module/tags
# Wget https://github.com/openresty/echo-nginx-module/archive/v0.60.tar.gz
# Tar zxvf v0.60.tar.gz
# Mv echo-nginx-module-0.60 tools/

2. Install nginx
# Wget http://nginx.org/download/nginx-1.10.1.tar.gz
# Tar-zxvf nginx-1.10.1.tar.gz
#/Application/nginx/sbin/nginx-V # view installed modules

3. Install the echo-nginx Module
#./Configure -- add-module =/root/tools/echo-nginx-module-0.60 # Install echo module (Folder name echo-nginx-module-0.60)
# Make # Start compilation, but do not install it (make install will directly overwrite the installation)
Note: Back up the old one and install it manually.
# Mv/application/nginx/sbin/nginx. old
# Make upgrade # smooth upgrade
# Make install # New Installation
# Make clean # (clear operation, which can be ignored)

4. Use of the ngix_echo Module
Location/echo {
Default_type text/html;
Set $ foo 'Hello world'; # custom Variables
Echo "$ request_uri"; # display nginx global variable content
Echo </br> $ foo; # display custom variable content
}

5. nginx global variables
$ Args: # This variable is equal to the parameter in the request line, which is the same as $ query_string
$ Content_length: # Content-length Field in the request header.
$ Content_type: # Content-Type field in the request header.
$ Document_root: # the value specified by the current request in the root command.
$ Host: # Request host header field. Otherwise, it is the server name.
$ Http_user_agent: # Client agent Information
$ Http_cookie: # client cookie Information
$ Limit_rate: # This variable can limit the connection rate.
$ Request_method: # client request action, usually GET or POST.
$ Remote_addr: # IP address of the client.
$ Remote_port: # The client port.
$ Remote_user: # username verified by Auth Basic Module.
$ Request_filename: # file path of the current request, which is generated by the root or alias command and URI request.
$ Scheme: # HTTP methods (such as http and https ).
$ Server_protocol: # The protocol used by the request, usually HTTP/1.0 or HTTP/1.1.
$ Server_addr: # server address, which can be determined after a system call.
$ Server_name: # server name.
$ Server_port: # the port number of the request to reach the server.
$ Request_uri: # The original URI containing the request parameters, excluding the host name, for example, "/foo/bar. php? Arg = baz ".
$ Uri: # The current URI without request parameters. $ uri does not contain the host name, for example, "/foo/bar.html ".
$ Document_uri: # Same as $ uri

 

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.