apache配置文件详解及虚拟主机的搭建
1、404跳转:
<IfModule dir_module>
DirectoryIndex index.php index.html /error.php
</IfModule>
#/error.php是apache的根目录
2、apache配置段:
(1)目录权限限制
Alias /dir/ "/var/www/html" #虚拟目录即访问dir的时候跳转到/var/www/html目录
<Directory /var/www/html/> #目录访问权限 ,或者<Directory /var/*/html/> *表示通配符
Options Indexes FollowSymLinks #允许目录索引,支持软连接
Order Allow,Deny #先允许后拒绝
Deny from 192.168.1.111 #拒绝访问该目录
Allow from all #允许访问该目录
AllowOverride All #开启.htaccess(默认是开启的),把目录配置权限交给用户,上面的配置内容不用写
</Directory>
(2)文件权限限制(Files可以嵌套到Directory配置段里,即限制某个目录下的某个文件不能访问)
<Files "demo.html">
Order Deny,Allow
Deny from all
</Files>
<FilesMatch \.(gif|jpe?g|png)$> #正则模式
Order Deny,Allow
Deny from all
</FilesMatch>
(3)以pri开头的网络地址
<Location '/pri'>
......
</Location>
3、.htaccess(不建议使用,比较浪费apache资源)
Options Indexs FollowSymLinks #允许目录索引,支持软连接
Order Allow,Deny #先允许后拒绝
Allow from all #允许所有访问
4、虚拟主机的配置(重点):
#
# 管理员邮箱
# 网站根目录
# Directory限制该目录的权限
# 绑定域名
# 绑定其他域名
# 错误日志
# 正常访问日志
#
<VirtualHost *:80>
ServerAdmin admin@php.com
DocumentRoot "/home/php5"
<Directory "/home/php5">
Options Indexes FollowSymLinks
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
ServerName www.php.com
ServerAlias cs.php.com
ErrorLog "/home/php5/logs/error_log"
CustomLog "/home/php5/logs/access_log"
</VirtualHost>
# 禁止所有以logs开头的文件都禁止访问
<Location "/logs">
Order Deny,Allow
Deny from all
</Location>
apache配置文件详解及虚拟主机的搭建的更多相关文章
- (原创)LAMP搭建之二:apache配置文件详解(中英文对照版)
LAMP搭建之二:apache配置文件详解(中英文对照版) # This is the main Apache server configuration file. It contains the # ...
- ubuntu apache2配置详解(含虚拟主机配置方法)
ubuntu apache2配置详解(含虚拟主机配置方法) 在Windows下,Apache的配置文件通常只有一个,就是httpd.conf.但我在Ubuntu Linux上用apt-get inst ...
- apache配置文件详解与优化
apache配置文件详解与优化 一.总结 一句话总结:结合apache配置文件中的英文说明和配置详解一起看 1.apache模块配置用的什么标签? IfModule 例如: <IfModule ...
- Apache配置文件详解
1.1 ServerRoot 配置 [ServerRoot "" 主要用于指定Apache的安装路径,此选项参数值在安装Apache时系统会自动把Apache的路径写入.Windo ...
- apache配置文件详解(中英文对照版)
# This is the main Apache server configuration file. It contains the # configuration directives that ...
- Apache 配置文件详解
0x01 禁止目录列表访问 () 备份httpd.conf配置文件,修改内容: <Directory "/web"> Options FollowSymLinks Al ...
- linux下的apache配置文件详解
.Apache的配置由httpd.conf文件配置,因此下面的配置指令都是在httpd.conf文件中修改. 站点的配置(基本配置) (1) 基本配置: ServerRoot "/mnt/s ...
- Apache服务的主要目录和配置文件详解
Apache服务的主要目录和配置文件详解 2014-01-14 19:05:14 标签:httpd配置文件详解 apache配置文件 httpd配置文件 apache文件目录 原创作品,允许转载,转载 ...
- ubuntu nginx 安装以及配置文件详解
1.到nginx官网下载源码包.最好下载稳定版本,nginx官网http://www.nginx.org/ 2.安装nginx依赖包运行命令: sudo apt-get install libssl- ...
随机推荐
- 监听EditText输入完成
最近有个需求,要在用户输入完快递单号之后,请求快递100接口,拿到快递公司信息.总不能用户输入一个数字就请求一次吧,给服务器造成不必要的压力(虽然不是自家服务器).但是又无法知晓用户何时输入完毕,每家 ...
- (38)C#IIS
IIS7.5标识介绍(转) http://www.cnblogs.com/zgqys1980/p/3862815.html 应用程序池的标识是运行应用程序池的工作进程所使用的服务帐户名称.默认情况下, ...
- socket的accept: Invalid argument问题
void local_sdk_server::wait_remote_client_connect_and_comm() { /*服务器服务启动,等待客户端的链接的到来*/ //sockaddr_in ...
- TClientDataSet的 fastscript封装
TClientDataSet的 fastscript封装 // 陈新光 2017-2-10// TClientDataSet's fastscript unit fs_ClientDataSet; i ...
- vbox在共享文件夹设置链接报错Protocol error问题
环境: 基于VBox 的 vagrant (centos版本)开发环境. 问题: Virtualbox 虚拟机(centOS)中,在进行go程序编译的时候,需要设置一个链接符,然后得到了如下的错误: ...
- Java反射之Field用法
在Java反射中Field用于获取某个类的属性或该属性的属性值 一:如何通过Field反射获取类的属性 Field提供如下几种方法: :1:Class.getDeclaredField(String ...
- Unable to connect to the MKS : Failed to connect to server XXXXXX:903
Issue : 通过 vSphere 连接VM控制台的时候, 报错 Unable to connect to the MKS : Failed to connect to server X ...
- 第七讲_图像描述(图说)Image Captioning
第七讲_图像描述(图说)Image Captioning 本章结构 递归神经网络 时序后向传播(BPTT) 朴素Vanilla-RNN 基本模型 用sigmoid存在严重的梯度消失 LSTM长短时记忆 ...
- fastjson中Map与JSONObject互换,List与JOSNArray互换的实现
1.//将map转换成jsonObject JSONObject itemJSONObj = JSONObject.parseObject(JSON.toJSONString(itemMap)); 将 ...
- django 实现下载功能
from django.http import FileResponse def download(request): if..... file=open([path],'rb') response= ...