日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

初学 Nginx (一) SSI 的作用

發布時間:2023/12/15 综合教程 33 生活家
生活随笔 收集整理的這篇文章主要介紹了 初学 Nginx (一) SSI 的作用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

SSI:ServerSideInclude,是一種基于服務端的網頁制作技術,

Nginx ssi 的例子如下:

It took a little while to figure this out and it’s handy for creating one-off sites with “dynamic” content without a web framework.

user nginx;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile      on;
    tcp_nopush    on;
    keepalive_timeout 10;
    gzip          on;

    server {
        server_name  localhost;
        charset      utf-8;
        access_log   /var/log/nginx/access.log;

        root    /var/www;

        location = / {
            rewrite ^ /home redirect;
        }

        location / {
            ssi on;
            set $inc $request_uri;
            if (!-f $request_filename) {
                rewrite ^ /index.html last;
            }
            if (!-f $document_root$inc.html) {
                return 404;
            }
        }
    }
}

Then if you have an index.html file similar to this:

<html>
  <body>
    <!--# include file="$inc.html" -->
  </body>
</html>

it will now include (via SSI) whatever page is requested. So for example /home would include home.html into index.html. This makes it easy to have a common style (headers and footers) without resorting to PHP or a framework.

It assumes home.html exists.

從列子不難看出 ssi的 的作用, 有點像jsp的include 標簽 ,不同的是 ssi 引用的 頁面 來自靜態頁面 ,是不經過后臺的。

這里是一點點 體會。有不同看法的歡迎大家經常討論。

總結

以上是生活随笔為你收集整理的初学 Nginx (一) SSI 的作用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。