博客
关于我
nodejs支持ssi实现include shtml页面
阅读量:803 次
发布时间:2023-02-16

本文共 392 字,大约阅读时间需要 1 分钟。

Express 对于 include 的代码默认不处理,直接输出,无法执行包含的内容。但可以通过 Nginx 实现。

配置 Nginx 开启 SSI 模式

在 Nginx 配置中,开启 SSI 模式并设置相关选项:

server {    ...    ssi on;    ssi_silent_errors on;    ssi_types text/shtml;    ...}

添加包含页面

在 HTML 文件中添加包含内容:

或者:

注意virtual 模式下,路径是相对服务目录的。

虚拟目录示例

假设虚拟目录结构如下:

--- /var/www/html    --- public        --- index.html        --- bottom.shtml

实现效果

通过上述配置,可以实现 include 内容的正确加载,效果如图所示。

转载地址:http://ixjfk.baihongyu.com/

你可能感兴趣的文章
NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty()
查看>>
npm run build 失败Compiler server unexpectedly exited with code: null and signal: SIGBUS
查看>>
npm WARN deprecated core-js@2.6.12 core-js@<3.3 is no longer maintained and not recommended for usa
查看>>
npm和yarn的使用对比
查看>>
npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
查看>>
npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
查看>>
NR,NF,FNR
查看>>
nrf开发笔记一开发软件
查看>>
NSDateFormatter的替代方法
查看>>
NSOperation基本操作
查看>>
NSSet集合 无序的 不能重复的
查看>>
NT AUTHORITY\NETWORK SERVICE 权限问题
查看>>
ntko文件存取错误_苹果推送 macOS 10.15.4:iCloud 云盘文件夹共享终于来了
查看>>
nullnullHuge Pages
查看>>
numpy 用法
查看>>
Numpy如何使用np.umprod重写range函数中i的python
查看>>
oauth2-shiro 添加 redis 实现版本
查看>>
OAuth2.0_JWT令牌-生成令牌和校验令牌_Spring Security OAuth2.0认证授权---springcloud工作笔记148
查看>>
OAuth2.0_JWT令牌介绍_Spring Security OAuth2.0认证授权---springcloud工作笔记147
查看>>
OAuth2.0_介绍_Spring Security OAuth2.0认证授权---springcloud工作笔记137
查看>>