Apache, Nginx service configuration server-side include (SSI) _linux

Source: Internet
Author: User

If you do not know what the server side contains (SSI) Click on the link below to view: http://lamp.linux.gov.cn/Apache/ApacheMenu/howto/ssi.html

First, Apache configuration SSI Features

Modify Apache configuration file httpd.conf

1. Confirm loading the Include.so module and remove the annotation:

LoadModule Include_module libexec/apache2/mod_include.so

2. The AddType section removes these two paragraphs of annotations:

AddType text/html. shtml
Addoutputfilter INCLUDES. shtml

3. Directory directory permissions found inside

Options Indexes FollowSymLinks

Add includes modifications to:

Options Indexes followsymlinks Includes

4. Restart Apache, test.

Second, Nginx configuration SSI Features

Add the following sentences to the HTTP segment:

SSI on;
Ssi_silent_errors off;
Ssi_types text/shtml;

Three, shtml streamlined course

You can write SSI instructions in the shtml file, and when the client accesses these shtml files, the server side reads and interprets the shtml files to explain the SSI instructions contained in the sHTML file.

For example, you can use SSI directives in shtml files to refer to other HTML files (#include), and the files that the server sends to the client are shtml that have been interpreted without SSI directives. It implements the HTML does not have the function, is may realize the dynamic shtml, can say is an HTML evolution. Like Sina's news system is like this, the news content is fixed, but its above advertisement and the menu and so on is uses the #include reference to come in.

At present, mainly has the following several uses: more please refer to: http://www.javaeye.com/topic/306216

1. Display server-side environment variables < #echo >

Name of this document:

<!– #echo var= "Document_name" –>

Now time:

<!– #echo var= "date_local" –>

Show IP Address </ins>

<! #echo var= "REMOTE_ADDR" –>

2. Insert text content directly into the document < #include >

<! #include file= "file name" –>

<! #include virtual= "file name" –>

The file file name is a relative path that corresponds to the directory where the document using the #include directive resides. The included file can be in the same level of directory or its subdirectories, but not in the previous level directory. File= "nav_head.htm", such as the nav_head.htm document that represents the current directory.

The virtual file name is the full path to the dummy directory on the Web site. For example, the Nav_head.htm file that represents the Hoyi directory under the root directory of the server document; virtual= "/hoyi/nav_head.htm"

3, display Web documents related information < #flastmod >< #fsize > (such as file production date/size, etc.)

File Last updated:

<! #flastmod file= "file name" –>

Length of File:

<!– #fsize file= "file name" –>

4, direct execution of various programs on the server < #exec > (such as CGI or other executable programs)

<!– #exec cmd= "file name" –>

<!– #exec cgi= "file name" –>

Inserts the output of an external program into the page. You can insert a CGI program or the input of a regular application, depending on whether you use the parameter cmd or CGI.

5, set SSI information display format < #config > (such as file production date/size display mode)

6, the advanced SSI can set variables to use the IF condition statement.

Second, shtml streamlined course
You can write SSI instructions in the shtml file, and when the client accesses these shtml files, the server side reads and interprets the shtml files to explain the SSI instructions contained in the sHTML file. For example, you can use SSI directives in shtml files to refer to other HTML files (#include), and the files that the server sends to the client are shtml that have been interpreted without SSI directives. It implements the HTML does not have the function, is may realize the dynamic shtml, can say is an HTML evolution. Like Sina's news system is like this, the news content is fixed, but its above advertisement and the menu and so on is uses the #include reference to come in.
At present, mainly has the following several uses: more please refer to: http://www.javaeye.com/topic/306216
1. Display server-side environment variables < #echo >
Name of this document:
<!– #echo var= "Document_name" –>
Now time: <!– #echo var= "date_local" Display IP address </ins><! #echo var= "REMOTE_ADDR"
2. Insert text content directly into the document < #include >
<!– #include file= "file name" –>
<!– #include virtual= "file name" –>
The file file name is a relative path that corresponds to the directory where the document using the #include directive resides. The included file can be in the same level of directory or its subdirectories, but not in the previous level directory. File= "nav_head.htm", such as the nav_head.htm document that represents the current directory.
The virtual file name is the full path to the dummy directory on the Web site. For example, the Nav_head.htm file that represents the Hoyi directory under the root directory of the server document; virtual= "/hoyi/nav_head.htm"
3, display Web documents related information < #flastmod >< #fsize > (such as file production date/size, etc.)
File Last modified: <! #flastmod file= The length of the file name –> file: <!– #fsize file= "file name" –>
4, direct execution of various programs on the server < #exec > (such as CGI or other executable programs)
<!– #exec cmd= "file name" –>
<!– #exec cgi= "file name" –>
Inserts the output of an external program into the page. You can insert a CGI program or the input of a regular application, depending on whether you use the parameter cmd or CGI.
5, set SSI information display format < #config > (such as file production date/size display mode)
6, the advanced SSI can set variables to use the IF condition statement.

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.