您的位置:首页 > 运维架构 > Apache

20170825L08-05老男孩linux实战运维培训-Lamp系列之-Apache服务生产实战应用指南02

2017-08-28 17:35 981 查看
这一节说Apache的安装目录文件
具体介绍了一些重要文件的配置

tree -L 1 /usr/local/apache

[root@llh extra]# tree -L 1 /usr/local/apache
/usr/local/apache
├── apache -> /usr/local/apache
├── bin
├── build
├── cgi-bin
├── conf
├── error
├── htdocs
├── icons
├── include
├── lib
├── logs
├── man
├── manual
└── modules

bin目录apache一些重要的命令放在这里

apachectl 命令是apache启动,重启,和停止命令

htdocs主目录文件位置
[root@llh apache]# tree htdocs
htdocs
└── index.html

conf文件内都是一些配置文件
[root@llh apache]# tree -L 1 conf
conf
├── extra
├── httpd.conf
├── magic
├── mime.types
└── original
当然最重要的文件是httpd.conf

log目录日志文件存放地址
.
├── access_log
├── error_log
└── httpd.pid
access是访问日志
error错误日志
httpd.pid 有apache运行时候的进程id号

modules放模块的目录,如编译php,memcache

讲解httpd.conf文件
ServerRoot file #后面接的是apache主安装文件位置
Listen 80 #用来设定访问端口的也可以指定IP
Listen 12.88.99.12:80
也可以指定多个端口比如
Listen 80
Listen 88
......

设置用户组和用户用来访问服务
User daemon
Group daemon

ServerAdmin xxxx@163.com #服务器出问题后通知管理员的邮箱设置
ServerName #给服务器设置一个名字

网站的默认页存放目录
DocumentRoot "/usr/local/apache2/htdocs"

控制目录权限的
以下为根目录权限
<Directory />
AllowOverride none #禁重载
Require all denied #禁示所有限止的访问
</Directory>

<Directory "/usr/local/apache2/htdocs">
#
# 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 #htaccess可以网站开发人员来参与权限管理,默认是不开的

#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>

看httpd.conf使用的设置行统计
egrep -v "^.*#|^$" httpd.conf|nl

extra是apache的扩展配置文件目录
[root@llh extra]# tree
.
├── httpd-autoindex.conf
├── httpd-dav.conf
├── httpd-default.conf
├── httpd-info.conf
├── httpd-languages.conf
├── httpd-manual.conf
├── httpd-mpm.conf
├── httpd-multilang-errordoc.conf
├── httpd-ssl.conf
├── httpd-userdir.conf
├── httpd-vhosts.conf
└── proxy-html.conf

其中主要说的是httpd-vhosts.conf这上配置文件
这是虚拟主机的配置文件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  apache
相关文章推荐