apache配置文件详解

apache配置的文件详解

//apache安装目录
ServerRoot "/usr/local/apache2/"

//apache默认监听的端口
Listen 80

//apache去加载模块
LoadModule authn_file_module modules/mod_authn_file.so

//php是作为apache一个模块来运行的
LoadModule php7_module modules/libphp7.so

//管理apache的用户
User daemon

//管理apache的用户组
Group daemon

// 当用户通过浏览器访问apache,其实是通过daemon来访问apache。

//写上你的IP地址、或者域名
ServerName www.example.com:80

// 指定网页的根目录
DocumentRoot "/usr/local/apache2//htdocs"

//
<Directory "/usr/local/apache2//htdocs">

//有Indexes,显示列表页,无Indexes,不显示列表页
Options Indexes FollowSymLinks

//AllowOverride的值是All,.htaccess文件就生效,当AllowOverride的值是None,.htaccess不生效
AllowOverride None

// Require all granted 所有Ip都可以访问
#Require all granted

//不想192.168.17.1 IP访问apache
<RequireAll>
Require all granted
Require not ip 192.168.17.1
</RequireAll>
</Directory>


//当index.html存在,用户访问IP、域名,就会自动访问index.html
DirectoryIndex index.html index.php

// 匹配到.ht开头的文件 .htaccess, 拒绝访问
<Files ".ht*">
Require all denied
</Files>

//错误日志文件
ErrorLog "logs/error_log"

//记录着谁访问了你的Apache
CustomLog "logs/access_log" common

//自定义404页面
ErrorDocument 404 /missing.html

//加载apache子配置文件
Include etc//extra/httpd-vhosts.conf

posted @ 2018-02-05 11:31  一七令  阅读(228)  评论(0编辑  收藏  举报