Ubuntu 14.04 LTS Apache2 开启 SSI 功能
来源:互联网 发布:金蝶软件优缺点 编辑:程序博客网 时间:2024/05/16 11:06
SSI (Server Side Include)的 html 文件扩展名 (.shtml), 通常称为"服务器端嵌入"或者叫"服务器端包含"
说白了就是类似其他语言如 PHP include 引入其他文件,SSI 是通过配置服务器,一个静态 html 文件引入另一个 html 文件的功能。
被包含文件与父文件存在于相同目录中 <!-- #include file = "index.html" --> 被包含文件位于脚本虚拟目录中 <!-- #include virtual = "/scripts/tools/index.html" -->
(1) 如果 Ubuntu中还未安装APACHE服务器,请先安装
sudo apt-get install apache2
(2) 创建符号链接
sudo ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled
(3) 打开刚刚创建好的软连接配置文件
sudo vi /etc/apache2/mods-enabled/include.load
添加以下内容
# Depends: mime LoadModule include_module /usr/lib/apache2/modules/mod_include.so # 上面内容是已有的,添加下面内容 <Directory /var/www/html/> Options Indexes FollowSymLinks Includes AllowOverride None Order allow,deny allow from all # This directive allows us to have apache2's default start page # in /apache2-default/, but still have / go to the right place # Commented out for Ubuntu #RedirectMatch ^/$ /apache2-default/ AddType text/html .shtml .html #这两个是主要的配置文件 AddOutputFilter INCLUDES .shtml .html #加上 .html 意思是可以 include .html 文件 </Directory>
(4) 重启 apache2
重启:service apache2 restart
停止:service apache2 stop
启动:service apache2 start
(5) 测试
1.html
<html> <body> <!--#include file="2.html"--> </body> </html>
2.html
<h1> Hello World! </h1>
浏览器运行 1.html 成功显示 Hello World! 说明配置成功
本文转自:
http://blog.csdn.net/yilovexing/article/details/77715188
阅读全文
0 0
- Ubuntu 14.04 LTS Apache2 开启 SSI 功能
- Ubuntu 14.04 LTS Apache2 开启 SSI 功能
- apache2.2.11开启ssi功能
- Ubuntu 14.04 LTS Apache2 启用User Dir的功能
- tomcat7开启SSI功能
- Tomcat7开启SSI功能
- Tomcat7开启SSI功能
- Ubuntu 14.04 LTS Apache2 设置虚拟主机
- Ubuntu 14.04 LTS Apache2 启动、停止、重启
- ubuntu 12.04 LTS 开启root
- Apache2.4开启GZIP功能
- 如何开启Apache2 Rewrite功能
- Ubuntu 14.04 LTS下设置命令模式和开启ssh
- 【记录】Ubuntu 14.04 LTS自带截图功能的使用
- apache2.4 和php 开启gzip功能
- Ubuntu 14.04 开启启动器图标最小化功能
- ubuntu下apache2开启重写模式
- ubuntu下 apache2 开启/关闭模块方法
- 怎么安装redis并测试?
- linux 使用 tmux 运行后台程序
- Android RxJava 基于事件的异步库
- Android命令Monkey压力测试,详解
- C++读写txt文件(基本操作1)
- Ubuntu 14.04 LTS Apache2 开启 SSI 功能
- C++ 11 多线程 (一)
- LightOJ
- 取当前进程对应之静态映像文件的绝对路径/proc/self/exe
- 打开目录、读取目录里面的内容 opendir readdir
- 软件调试笔记27
- .net System.Web.Mail发送邮件 (已过时)
- android.view.View android.view.View.findViewById(int)' on a null object reference
- msql用分表优化2亿数据查询速度