# apache根目录,应只能root访问
ServerRoot "/application/apache.."
# apache服务默认的监听端口 如果需要同时监听多个端口可以在后面加行:listen 81
Listen 80
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon # apache的用户,默认为daemon
Group daemon # apache的用户,默认为daemon
</IfModule>
</IfModule>
# 系统管理员邮箱,如果出现问题,会在首页显示
ServerAdmin you@example.com
# apache的默认web站点目录路径,结尾不要添加斜线
DocumentRoot "/application/apache../htdocs"
<Directory /> # - 行为对根目录的限制
Options FollowSymLinks # followsymlinks表示允许使用符号链接,默认为禁用
AllowOverride None # 表示禁止用户对目录配置文件(.htaccess进行修改)重载,普通站点不建议开启
Order deny,allow #以deny方式优先处理,没有明确说明拒绝的话都通过,即允许未被明确拒绝的访问(从后往前)。
Deny from all # 明确指出拒绝所有访问
</Directory>
<Directory "/application/apache../htdocs"> # - 行为默认apache默认站点目录的限制配置(如果配置的站点不存在,出现错误)
Options Indexes FollowSymLinks # FollowSymLinks 禁止使用符号链接 Indexes 表示允许用户浏览目录
Options -Indexes FollowSymLinks 或者 Options FollowSymLinks表示取消目录浏览的功能
AllowOverride None # 表示禁止用户对目录配置文件(.htaccess进行修改)重载,不建议开启
Order allow,deny # 以allow优先处理,没有明确说明允许的话都拒绝,拒绝未被明确允许
Allow from all # 允许所有的访问
</Directory>
<IfModule dir_module>
#配置默认的apache首页文件,如果虚拟机中没有配置,应用这里的配置,多个用空格隔开
DirectoryIndex index.html
</IfModule>
<FilesMatch "^\.ht"> # 防止.htaccess和.htpasswd等重要隐藏文件被web用户查看
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
#错误的日志路径logs为apache服务安装目录的相对路径LogLevel warn
ErrorLog "logs/error_log"
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined # 访问日志格式
LogFormat "%h %l %u %t \"%r\" %>s %b" common # 访问普通日志格式
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" common #默认站点访问日志配置
</IfModule>
<IfModule alias_module>
# CGI的配置,没有特殊需求可以注释和删除,目前基本已经淘汰
ScriptAlias /cgi-bin/ "/application/apache../cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/application/apache../cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#DefaultType定义不能确定mime类型时服务器提供的默认MIME类型,如果服务主要包含text或html文档,“text/plain”是一个最好的选择
DefaultType text/plain
<IfModule mime_module>
TypesConfig conf/mime.types
# addencoding允许你在信息传送中使用maxaic/X .+解压缩信息(不能支持所有的浏览器)
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
转载于:https://my.oschina.net/qqlet/blog/1438837