首页 > 系统相关 >Nginx之SSI

Nginx之SSI

时间:2024-02-22 10:00:58浏览次数:30  
标签:nginx 404 Nginx html SSI 页面

一、简介

       SSI 【Server Side Inclde】。基于服务端的网页制作技术,即服务端包含。该项目中用到了Nginx中的SSI模块的include命令,这个命令会包含一个页面,然后在nginx服务器中展开。

二、使用

       2.1、开启SSI

               Linux路径地址为:

                默认的配置文件为:/etc/nginx/nginx.conf

               修改为:

server {
        listen       80;
        listen       [::]:80;
        server_name  _;
        
        # 配置SSL
          ssi on; # 开启SSI支持
          ssi_silent_errors on; # 默认为off,设置为on则在处理SSI文件出错时不输出错误信息
          # ssi_types text/html; # 需要支持的shtml 默认是 text/html
       
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        error_page 404 /404.html;
        location = /404.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }

         html文件路由:     

          html3.html内容:注意Nginx的SSI指令格式

<h1>我是html3</h1>
<!--# include file="html1.html" -->
<!--# include file="html2.html" -->

        运行结果:

     这样就可以通过Nginx静态页面的静态页面和动态页面合并问题。从而处理部分秒杀系统商品页面优化的问题。

标签:nginx,404,Nginx,html,SSI,页面
From: https://www.cnblogs.com/xiaobaicai12138/p/18025475

相关文章

  • nginx的安装(文心一言)
    在Ubuntu中安装Nginx可以通过APT包管理器进行。以下是在Ubuntu中安装Nginx的步骤:1.更新软件包列表:首先,打开终端并更新您的软件包列表,以确保您安装的是最新的软件包。sudoaptupdate2.安装Nginx:接下来,使用APT包管理器安装Nginx。sudoaptinstallnginx安装过程中,您可能会被提......
  • 读论文-基于序列/会话的推荐:挑战,方法,应用和机遇(Sequential/Session-based Recommend
    前言今天读的论文为一篇于2022年7月7日发表在第45届国际ACM信息检索研究与发展会议论文集(Proceedingsofthe45thInternationalACMSIGIRConferenceonResearchandDevelopmentinInformationRetrieval.)的论文,文章主要讲述了序列推荐系统(SRSs)和基于会话的推荐系统(SBRSs......
  • 自己新写的软件, 使用nginx反向代理
    windows版本安装包: https://nginx.org/en/download.html   nginx用于代理服务器,常用于负载均衡等,可以实现用户请求转发。 在python中,为了提高程序的并发性能,使其能够满足更高的访问量,一般会利用多进程以及协程,对程序进行改造。但是服务在启动的时候,随之确定的也就......
  • home-assistant core 源码粗读--对设备历史的处理(三)
    我们已经知道User等保存是直接以json的形式直接保存到文件中。先说结论:设备的检测历史默认保存在sqlite中Thedefault,andrecommended,databaseengineis SQLite whichdoesnotrequireanyconfiguration.ThedatabaseisstoredinyourHomeAssistantconfigurati......
  • Nginx 配置限流
    Nginx配置限流1概述2限制请求速率2.1、正常限流2.2、处理突发流量2.3、设置白名单2.4、limit_req重复3限制连接数4上传/下载速率限制4.1、limit_rate4.2、limit_rate_after4.3、proxy_limit_rate4.4、动态限速4.2、基于变量动态限速1概述限流(RateLimitt......
  • home-assistant core 源码粗读--如何管理多用户-用户存储(二)
    程序中搜索User, 很容易命中homeassistant/auth/models.py程序中大量使用了attr.s进行模型的声明。上篇说过dataclass,以及BaseModel,区别见: https://www.modb.pro/db/412679文件中定义了5个模型,这里只需要猜测他们的意思即可,这里重点分析User。程序中搜索User, 很容易命......
  • Linux服务器配置nginx访问静态网页
    配置nginx 打开conf文件进行编辑:sudonano/etc/nginx/nginx.conf在http块内添加:server{listen80;server_namexxx.your_domain.com;root/root/work/your_web_folder;indexindex.html;}重启nginx:sudoservicenginxrestart如果......
  • Mac安装Nginx
    Nginx安装#查找nginx版本brewsearchnginx#安装nginx,默认是最新版本brewinstallnginx#指定版本安装方式为:nginx@版本号[email protected]#卸载nginxbrewuninstallnginxbrewuninstallnginx@版本号#查看已安装的软件brewlist#查看nginx安装信息(eg:......
  • [转帖]nginx利用request_body记录POST body(location中用proxy_pass)
    https://www.cnblogs.com/freedom-try/p/14699538.html1.完整过程1.1在nginx.conf中http里面添加配置如下:http{ ... log_formatpostdataescape=json'$remote_addr-$remote_user[$time_local]"$request" '$status$bod......
  • Linux 安装 Nginx
    一、步骤    1、配置EPEL源   sudoyuminstall-yepel-releasesudoyum-yupdate    2、安装Nginxsudoyuminstall-ynginx     安装成功后,默认网站目录为:/usr/share/nginx/html     默认的配置文件为:/etc/nginx/nginx.conf......