apache 的httpd.conf常用配置说明
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used. If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "/usr/local/httpd"
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80 (此处可以加其他的全局apache端口如 Listen 8080, 也可以在<VirtualHost> 之外添加某一个虚拟配置的监听端口)
LoadModule deflate_module modules/mod_deflate.so 启用压缩的模块
LoadModule expires_module modules/mod_expires.so 过期模块
LoadModule ssl_module modules/mod_ssl.so (https服务所需要的模块)
LoadModule vhost_alias_module modules/mod_vhost_alias.so (虚拟配置重命名所需模块)
LoadModule alias_module modules/mod_alias.so (启用多域名所需模块)
LoadModule rewrite_module modules/mod_rewrite.so(重定向所需模块)
LoadModule php5_module modules/libphp5.so (解析php文件所需模块)
<Directory />
AllowOverride none
Require all denied
</Directory>
这个配置改为以下配置比较通用
<Directory />
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
DocumentRoot "/var/www/html"(默认文件根路径)
<Directory "/var/www/html">
#
# 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.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
Directory 配置中建议改为
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
比较通用
<IfModule dir_module>(默认路径的首次解析文件)
DirectoryIndex index.php index.html
</IfModule>
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
以下两行为解析php所需添加的配置
AddType application/x-httpd-php .php
AddType application/x-httpd-php-sourece .phps
Include /etc/httpd/extra/httpd-vhosts.conf 引进虚拟配置文件
Include /etc/httpd/conf.d/*.conf 引进conf.d目录下的配置文件如ssl.conf文件
//设置过期时间的文件和gzip压缩相关参数
<IfModule mod_deflate.c>
DeflateCompressionLevel 5
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/json
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:pdf|mov|avi|mp3|mp4|rm)$ no-gzip dont-vary
AddOutputFilterByType DEFLATE text/*
AddOutputFilterByType DEFLATE application/ms* application/vnd* application/postscript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php application/x-httpd-fastphp
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A0
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A9030400
</FilesMatch>
<FilesMatch "\.(jpg|jpeg|png|gif|swf|js|css)$">
ExpiresDefault A604800
</FilesMatch>
</IfModule>
虚拟配置文件:
Listen 8080(添加某一个配置的监听端口)
<VirtualHost *:8080>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/var/www/html/wtsdata/app/web"
ServerName test.wts.199.com
ServerAlias alais.wts.test.199.com
<Directory "/var/www/html/wtsdata/app/web">
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/199-error_log"
CustomLog "logs/199-access_log" common
</VirtualHost>
.png)
.png)
.png)
- ssh 配置文件讲解大全 ssh调试模式 sftp scp strace进行调试 特权分离
ssh 配置文件讲解大全 ssh调试模式 sftp scp strace进行调试 特权分离 http://blog.chinaunix.net/uid-16728139-id-3265394.h ...
- Linux学习之路--常用命令讲解
Linux常用命令讲解 1.命令格式:命令 [-选项] [参数] 超级用户的提示符是# 一般用户的提示符是$ 如:ls -la /usr说明: 大部分命令遵从该格式多个选项时,可以一起写 eg:ls ...
- Mac中Apache常用命令
Apache常用命令记录,还是记一下吧,总是忘记. Apache常用命令: # sudo apachectl start // 启动Apache服务 # sudo apachectl stop // ...
- apache常用工作模式的区别
apache常用工作模式有两种 worker模式1.线程模式2.占用资源少3.稳定性略差4.并发大 prefork模式1.进程模式2.占用资源多3.稳定4.并发一般 来自为知笔记(Wiz)
- 通过修改 Apache 的配置文件 htaccess 文件实现自定义404页面
最近在学习使用Apache服务器的配置,做一个记录. Apache下有个.htaccess文件,是Apache的一个特殊的配置文件.这个配置文件默认是没有的,要手动在各自的项目的根目录编写才行. 要实 ...
- SpringBoot2.x配置文件讲解
SpringBoot2.x配置文件讲解 简介:SpringBoot2.x常见的配置文件 xml.yml.properties的区别和使用 xml.properties.json.yaml 1.常见的配 ...
- Navicat Premium 常用功能讲解
https://www.linuxidc.com/Linux/2016-04/130159.htm Navicat Premium 常用功能讲解 1.快捷键 1.1. F8 快速回到当前对象列表 1. ...
- Oracle网络相关概念与常用配置文件
监听器(Listener) 监听器是Oracle基于服务端的一种网络服务,主要用于监听客户端向数据库服务器提出的链接请求. 本地服务名(Tnsname) Oracle客户端与服务器端的链接是通过客户端 ...
- Apache检查配置文件语法
Windows环境:httpd -t或者: httpd.exe -w -t -f "C:\Apache2.2\conf\httpd.conf" -d "C:\Apache ...
随机推荐
- VSTO:使用C#开发Excel、Word【9】
文件背后的代码VSTO支持文档背后的代码,要求开发人员使用VSTO项目中生成的具有预连接上下文和预连接事件的类.这些类有时被称为“代码后面”类,因为它们是与特定文档或工作表相关联的代码.在Word中, ...
- C++11智能指针 share_ptr,unique_ptr,weak_ptr用法
0x01 智能指针简介 所谓智能指针(smart pointer)就是智能/自动化的管理指针所指向的动态资源的释放.它是存储指向动态分配(堆)对象指针的类,用于生存期控制,能够确保自动正确的销毁动 ...
- linux执行可执行文件时报xxx:not found
实际上是因为可执行文件执行时所依赖的动态链接库找不到,解决方法为在编译时加-static表示使用静态链接. 或者使用arm-linux-readelf -d +可执行文件,查看该可执行文件依赖的动态链 ...
- MFC 添加背景图片并让控件背景透明
/*添加背景图片*/ BOOL CTOOLDlg::OnEraseBkgnd(CDC* pDC) { // TODO: 在此添加消息处理程序代码和/或调用默认值 CDialog::OnEraseBkg ...
- js编写轮播图,广告弹框
1.轮播图 js编写轮播图,需要用到setInterval(计时器):先给一个div,里面放轮播图的图片,将轮播图的图片明明为相同样式的:如:banner1.jpg,banner2.jpg,banne ...
- L2-002. 链表去重(数组模拟)
L2-002. 链表去重 因为数值比较小,所以直接用数组来模拟 #include<cstdio> #include<cstring> #include<iostream& ...
- C语言基础:数组 分类: iOS学习 c语言基础 2015-06-10 21:40 7人阅读 评论(0) 收藏
数组:是由一组具有相同数据类型的数据组合而来. 数组定义:元素类型修饰符 数组名[数组个数]={元素1,元素2....}; int arr[ 2 ]={1,2}; //正确 int arr[ ...
- n 中选 m —— 随机采样的艺术
0,1,2-n-1,n 个数中随机取 m 个数,要求 0, 1, n-1,此 n 个数每个数被取到的概率相同: Knuth 书中的随机化方法,很容易写出: void genkunth (int n, ...
- TAF /tars必修课(一):整体架构理解
来自零点智能社区 一.前言 TAF,一个后台逻辑层的高性能RPC框架,目前支持C++,Java, node 三种语言, 往后可能会考虑提供更多主流语言的支持如 go等,自定义协议JCE,同时也支持HT ...
- canvas默认是黑色全透明,不是白色全透明。