在Apache下开启SSI配置支持include shtml html和快速配置服务器
作为前端开发,使用Apache快速搭建服务器极为方便。
1.找到apach安装目录,找到conf目录下 的httpd.conf
使用SSI(Server Side Include)的html文件扩展名,SSI(Server Side Include),通常称为"服务器端嵌入"或者叫"服务器端包含",是一种类似于ASP的基于服务器的网页制作技术。默认扩展名是 .stm、.shtm 和 .shtml。
# AddType text/html .shtml
# AddOutputFilter INCLUDES .shtml
把这两行前面的#去掉 添加 .html类型之后碎片引入支持.html文件了。
AddType text/html .shtml .html
AddOutputFilter INCLUDES .shtml .html
然后搜索“Options Indexes FollowSymLinks”
在搜索到的那一行后面添加“ Includes”
即将该行改变为 Options Indexes FollowSymLinks Includes
熟悉apache manual的可能会觉得比较容易。
保存httpd.conf,重起apache即可
include元素能按file属性或virtual属性判断应该包含的文件。
file属性是一个相对于当前目录的文件路径,即不能是一个绝对路径(以"/"开头)或包含"../"的路径。
virtual属性可能更有用,它是一个相对于被提供的文档的URL ,可以以"/"开头,但必须与被提供的文档位于同一服务器上。
<!--#include virtual="/header.html" -->
2.快速配置服务器 找到conf目录下 的httpd.conf
把下面配置放在配置文件顶部即可快速搭建一个8200端口的服务器。复制该模块,修改端口和文件目录路径,即可快速搭建另外一个服务器。
#rho
Listen 8200
<VirtualHost *:8200>
documentroot "E:\work\rho"
servername localhost:8200
<Directory "E:\work\rho">
Options Indexes FollowSymLinks Includes
#ErrorDocument 404 /index.shtml
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
如果上面配置出现php文件禁止访问试试下面:
把
Order deny,allow
Allow from all
Allow from host ip
修改为:
Require all granted
Require host ip
2.4*版本的apache配置修改了配置方法
#test
Listen 8200
<VirtualHost *:8200>
servername localhost:8200
DocumentRoot "D:/work/test/todos-web-app-master"
<Directory "D:/work/test/todos-web-app-master">
Options Indexes FollowSymLinks ExecCGI
Require all granted
Require host ip
</Directory>
</VirtualHost>
如图效果:
配置文件默认配置:80端口,把端口和文件目录换成不常用的目录或端口,就可以直接吧上面快速配置服务器的配置改成80端口使用。下面的配置几乎跟上面等价。
#Listen 12.34.56.78:80
Listen
ServerName localhost:
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "e:/work/xtl"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "e:/work/xtl">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
allow from all
Allow from 127.0.0.1
</Directory>
3.配置允许通过IP访问服务器
默认的 http.conf 一段和访问控制有关的代码如下:
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
在httpd.conf文件中,修改如下
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
注意要Allow from all,这样才允许所有的IP访问。如果只是允许如下两个网段访问则:
Allow from 172.16.86.0/255.255.255.0 10.0.0.0/255.0.0.0
IP之间不是","逗号,而是空格
在Apache下开启SSI配置支持include shtml html和快速配置服务器的更多相关文章
- Apache下开启SSI配置使html支持include包含
写页面的同学通常会遇到这样的烦恼,就是页面上的 html 标签越来越多的时候,寻找指定的部分就会很困难,那么能不能像 javascript 一样写在不同的文件中引入呢?答案是有的,apache 能做到 ...
- Apache下开启SSI配置,使html支持include包含
有的时候,我们的页面有公共的导航栏navbar,公共的脚注footer,那么我们就想把这些公共部分独立成一个html文件,在要引用的地方像引用js,css一样,给包含进来. Apache下开启SSI配 ...
- 在Apache下开启SSI配置
开启SSI:html.shtml页面include网页文件 使用SSI(Server Side Include)的html文件扩展名,SSI(Server Side Include),通常称为&quo ...
- Apache配置支持include
Apache配置支持include 什么是SSI? SSI是英文Server Side Includes的缩写,翻译成中文就是服务器端包含的意思.从技术角度上说,SSI就是HTML文件中,可以通过注释 ...
- 对vue中 默认的 config/index.js:配置的详细理解 -【以及webpack配置的理解】-config配置的目的都是为了服务webpack的配置,给不同的编译条件提供配置
当我们需要和后台分离部署的时候,必须配置config/index.js: 用vue-cli 自动构建的目录里面 (环境变量及其基本变量的配置) var path = require('path') ...
- 开启SSI配置使shtml支持include公用的页头页脚
编写编写项目众多静态文件时,能像php等开发语言一样使用include将页面公有的header/footer/sidebar作为公用.独立.单一的文件引入到各页面上,这样修改这些页面公用部分时就能单独 ...
- windows Apache 环境下配置支持HTTPS的SSL证书
windows Apache 环境下配置支持HTTPS的SSL证书 1.准备工作 1)在设置Apache + SSL之前, 需要做: 安装Apache, 下载安装Apache时请下载带有SSL版本的A ...
- 如何让你的Apache支持include文件解析和支持shtml的相关配置
源地址:http://www.itokit.com/2011/0430/65992.html Apache支持include文件解析shtml首先要应该修改Apache配置文件httpd.conf . ...
- apache安装mod_deflate配置支持gzip
apache 配置支持gzip apache使用gzip压缩能够大幅提高网站访问速度并节省网络流量,在网页响应头信息中可以判断是否支持压缩. HTTP/1.1 200 OK Date: Wed, 14 ...
随机推荐
- Harris角点算法
特征点检测广泛应用到目标匹配.目标跟踪.三维重建等应用中,在进行目标建模时会对图像进行目标特征的提取,常用的有颜色.角点.特征点.轮廓.纹理等特征.现在开始讲解常用的特征点检测,其中Harris角点检 ...
- Wix#可以直接写C#代码来生成Wix的MSI安装文
博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:Wix#可以直接写C#代码来生成Wix的MSI安装文.
- 通达OA 小飞鱼工作流在线培训教程文件夹及意见征集
最近通达OA技术交流群有不少朋友反映说表单设计这块 改动样式的问题,这块须要html和css的改动.本来最近正好要在工作流这块准备做一个系列的课程,都是基础的设置主要是给刚接触工作流的朋友用的,大家有 ...
- CentOS 配置httpd使局域网能够正常訪问
[转载请注明出处: 钱国正的专栏http://blog.csdn.net/qianguozheng/article/details/37611859] 问题: 在CentOS上安装apache,配置好 ...
- 【转】cocos2d-x获取系统时间——2013-08-25 10
欢迎转载,本帖地址:http://blog.csdn.net/jinjian2009/article/details/9449585 之前使用过cocos2d-x获取系统时间,毫秒级的 long ge ...
- AFNetworking 3.0迁移指南
AFNetworking是一款在OS X和iOS下都令人喜爱的网络库.为了迎合iOS新版本的升级, AFNetworking在3.0版本中删除了基于 NSURLConnection API的所有支持. ...
- Android开发之位置定位详解与实例解析(GPS定位、Google网络定位,BaiduLBS(SDK)定位)
在android开发中地图和定位是很多软件不可或缺的内容,这些特色功能也给人们带来了很多方便.定位一般分为三种发方案:即GPS定位.Google网络定位以及基站定位 最简单的手机定位方式当然是通过GP ...
- js中的"=="与"==="的区别
"==": 1,如果两表达式的类型不同,则试图将它们转换为字符串.数字或 Boolean 量. 2,NaN 与包括其本身在内的任何值都不相等. 3,负零等于正零. 4,null 与 ...
- C#操控条形码扫描枪
// 条码扫描器 // 窗体部分相关代码: using System; using System.Collections.Generic; using System.ComponentModel; u ...
- CentOS6.3挂载读写NTFS分区
CentOS不像Fedora,默认是没有自动挂载NTFS的,而它可以利用NTFS-3G来实现挂载及读写. NTFS-3G 是一个开源的软件,可以实现 Linux.Free BSD.Mac OSX.Ne ...