linux学习-apache的安装和配置1
#/etc/httpd/conf/httpd.confServerRoot "/etc/httpd" #根目录设置
Listen 80 #监听本机所有80端口
Include conf.modules.d/*.conf #包含动态模块加载配置文件
User apache #以apache用户执行服务进程/线程
Group apache #以apche组执行服务进程/线程
ServerAdmin root@localhost #Apache用户E-mail为rootlocalhost
#设置对ServerRoot目录的访问控制
AllowOverride none #禁止使用基于目录的配置文件
Require all denied #拒绝一切客户访问ServerRoot目录的访问控制
DocumentRoot "/var/www/html" #主服务器的文档根目录为/var/www/html
#设置对/var/www目录的访问控制
AllowOverride None #禁止使用基于目录的配置文件
Require all granted #允许一切客户访问/var/www目录
#设置对/var/www/html目录的访问控制
Options Indexes FollowSymLinks #允许为此目录生成文件列表,语序符号链接跟随
AllowOverride None #禁止使用基于目录的配置文件
Require all granted #允许一切客户访问/var/www/html目录
DirectoryIndex index.html #指定目录的主页文件为index.html
Require all denied #拒绝一切客户访问“.ht*”文件
ErrorLog "logs/error_log" #指定错误文件日志的位置
LogLevel warn #指定记录高于warn级别的错误日志
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
CustomLog "logs/access_log" combined #指定访问日志文件的位置和格式
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
AllowOverride None
Options None
Require all granted
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
AddDefaultCharset UTF-8 #指定默认字符集
MIMEMagicFile conf/magic
EnableSendfile on #启用Sendfile机制以提高apche性能
IncludeOptional conf.d/*.conf #包含conf.d/*.conf目录下的配置文件
页:
[1]