Apache and Nginx service configuration server-side inclusion (SSI)

Source: Internet
Author: User

If you do not know what is server-side inclusion (ssi) click the link below to view: http://lamp.linux.gov.cn/Apache/ApacheMenu/howto/ssi.html

1. Configure SSI functions in Apache

Modify the Apache configuration file httpd. conf

1. Confirm to load the include. so module and remove the comments:

LoadModule include_module libexec/apache2/mod_include.so

2. Remove the annotations in the AddType section:

AddType text/html. shtml
AddOutputFilter between des. shtml

3. Find the Directory permission

Options Indexes FollowSymLinks

Add the pair des:

Options Indexes FollowSymLinks Includes

4. Restart Apache to test.

Ii. Configure SSI for Nginx

Add the following sentence to the http segment:

Ssi on;
Ssi_silent_errors off;
Ssi_types text/shtml;

Iii. SHTML simplified tutorial

You can write ssi commands in the shtml file. When the client accesses these shtml files, the server reads and interprets these SHTML files, explain the SSI commands contained in The SHTML file.

For example, you can use the SSI command in the SHTML file to reference other html files (# include). The files that the server sends to the client do not have SSI commands. It implements a function not available in HTML, that is, it can implement a dynamic SHTML. It can be said that it is an evolution of HTML. Like Sina's news system, the news content is fixed, but the advertisements and menus on it are referenced by # include.

At present, the main use of the following: More please refer to: http://www.javaeye.com/topic/306216

1. Display Server Environment Variables <# echo>

This document name:

<! -# Echo var = "DOCUMENT_NAME"->

Current Time:

<! -# Echo var = "DATE_LOCAL"->

Show IP addresses </ins>

<! # Echo var = "REMOTE_ADDR"->

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

<! # Include file = "file name"->

<! # Include virtual = "file name"->

The file name is a relative path, which is relative to the directory of the document using the # include command. The contained file can be in the same level directory or its sub-directory, but not in the upper level directory. For example, the nav_head.htmfile under the current directory is file1_nav_head.htm ".

The virtual File name is the complete path of the virtual directory on the Web site. For example, if the parameter is relative to the nav_head.htm file in the hoyidirectory under the Server File root directory, it is virtual = "/hoyi/nav_head.htm"

3. Display WEB Document Information <# flastmod> <# fsize> (for example, file creation date/size)

Last file update date:

<! # Flastmod file = "file name"->

File length:

<! -# Fsize file = "file name"->

4. directly execute various programs on the server <# exec> (for example, CGI or other executable programs)

<! -# Exec cmd = "file name"->

<! -# Exec cgi = "file name"->

Insert the output of an external program to the page. The input of a CGI program or a general application can be inserted, depending on whether the parameter is cmd or cgi.

5. Set SSI information display format <# config> (for example, file creation date/Size Display Mode)

6. Advanced SSI allows you to set variables to use the if Condition Statement.

Ii. SHTML simplified tutorial
You can write ssi commands in the shtml file. When the client accesses these shtml files, the server reads and interprets these SHTML files, explain the SSI commands contained in The SHTML file. For example, you can use the SSI command in the SHTML file to reference other html files (# include). The files that the server sends to the client do not have SSI commands. It implements a function not available in HTML, that is, it can implement a dynamic SHTML. It can be said that it is an evolution of HTML. Like Sina's news system, the news content is fixed, but the advertisements and menus on it are referenced by # include.
At present, the main use of the following: More please refer to: http://www.javaeye.com/topic/306216
1. Display Server Environment Variables <# echo>
This document name:
<! -# Echo var = "DOCUMENT_NAME"->
Current Time: <! -# Echo var = "DATE_LOCAL": IP address displayed </ins> <! # Echo var = "REMOTE_ADDR"
2. Insert text content directly into the document <# include>
<! -# Include file = "file name"->
<! -# Include virtual = "file name"->
The file name is a relative path, which is relative to the directory of the document using the # include command. The contained file can be in the same level directory or its sub-directory, but not in the upper level directory. For example, the nav_head.htmfile under the current directory is file1_nav_head.htm ".
The virtual File name is the complete path of the virtual directory on the Web site. For example, if the parameter is relative to the nav_head.htm file in the hoyidirectory under the Server File root directory, it is virtual = "/hoyi/nav_head.htm"
3. Display WEB Document Information <# flastmod> <# fsize> (for example, file creation date/size)
Last file update date: <! # Flastmod file = "file name"-> file length: <! -# Fsize file = "file name"->
4. directly execute various programs on the server <# exec> (for example, CGI or other executable programs)
<! -# Exec cmd = "file name"->
<! -# Exec cgi = "file name"->
Insert the output of an external program to the page. The input of a CGI program or a general application can be inserted, depending on whether the parameter is cmd or cgi.
5. Set SSI information display format <# config> (for example, file creation date/Size Display Mode)
6. Advanced SSI allows you to 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.