How to make Nginx/apache support the shtml format

Source: Internet
Author: User


Let's take a look at the relationship between html or htm and shtml or shtm.

Html or htm is a static page format, that is to say, the server does not need to parse the script, or there is no script executed by the server, and because it is based on SSI technology, shtml or shtm, when there is a server-side executable script, it is viewed as a dynamic programming language, just like asp, jsp, or php. When shtml or shtm does not contain server-side executable scripts, the role of shtml is the same as that of html or htm.


Nginx supports shtml file parsing, but it is disabled by default and needs to be enabled manually.


Add the following in the nginx. conf configuration file http:

 

The code is as follows: Copy code
Ssi on;
Ssi_silent_errors on;
Ssi_types text/shtml;

Save and restart nginx.

If you want to add the default homepage, you can find the Index option in nginx. conf and write it

The code is as follows: Copy code

Index index.shtml index.html index.htm

Save and restart nginx.


If you are using an apache server, we can refer to the following solution

How can your Apache server support SSI?

Apache does not support SSI by default. We need to change httpd. conf for configuration. Take Apache 2.0.x on windows as an example. Open the httpd. conf file in the conf directory and search "AddType text/html. shtml". The search result is as follows:

The code is as follows: Copy code


# AddType text/html. shtml
# AddOutputFilter between Des. shtml


Remove # from the front of the two rows.


Search "Options Indexes FollowSymLinks"
Add "des" after the row to be searched"
Change this row to Options Indexes FollowSymLinks Includes


Save httpd. conf and restart apache.

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.