Nginx Module Reference Manual: Substitution module (substitution)

Source: Internet
Author: User
Keywords Nginx substitution substitution Module
Tags compile configuration default default value http location nginx replace

If you want to use these modules, you must specify the relevant compilation parameters at compile time.

This module can be used to search for and replace text in Nginx answers.
To use this module, you must specify the following compilation parameters at compile time:

--with-http_sub_module option

Sample configuration:

Location/{sub_filter </head> ' </head><script language= ' javascript ' src= ' $script ' ></script> '; Sub_filter_once on;}

Instructions

Sub_filter

Syntax: Sub_filter text substitution
Default value: None
Working with fields: HTTP, server, location
The directive allows you to replace some text in the Nginx answer body to a different value, matching case-insensitive, replacing text with variables, and only one substitution rule in each location.

Sub_filter_once

Syntax: Sub_filter_once on|off
Default value: Sub_filter_once on
Working with fields: HTTP, server, location
Set to OFF replaces all occurrences of the matching field in the answer, and the default only replaces the first occurrence.

Sub_filter_types

Syntax: Sub_filter_types mime-type [Mime-type ...]
Default value: Sub_filter_types HTML
Working with fields: HTTP, server, location
Set Sub_filter Check the MIME type included, default only HTML.

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.