Let Nginx support the shtml format configuration method _nginx

Source: Internet
Author: User

For static web sites have the public need to include, and do not want to use dynamic Web pages to write, then shtml is the best choice. sHTML can contain the specified file to a document similar to the Include feature in PHP.

Nginx itself has supported shtml format file resolution, but is not enabled by default and needs to be manually turned on.
Open the Nginx configuration file nginx.conf and add the following three sentences to HTTP.

Copy Code code as follows:

# vi/usr/local/nginx/conf/nginx.conf

Add the following code to the http{}:
Copy Code code as follows:

SSI on;
Ssi_silent_errors on;
Ssi_types text/shtml;

PS. Here the file type can be changed to other, for example, let HTM also support SSI, then change the text/shtml to text/htm on the line, but in this case, because the server htm more files, it is not necessarily all using SSI to introduce other pages, Will cause some unnecessary consumption to the nginx, so it is not recommended to do so.

Save the reboot Nginx.
If you need to add a default home page, you can find the index option in nginx.conf and write

Copy Code code as follows:
Index index.shtml index.html index.htm

Save the reboot Nginx.

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.