下一版即将优化的apache配置文件分享.

分类
Qampp手册
更新时间
2018-09-05 11:14:50

趁有点时间, 就重新整理了一次apache的配置文件.


1: 解决qsvn浏览器上查阅代码的问题,

所有非二进制文件均可以直接在浏览器上查阅代码了. 默认编辑字符为UTF-8 (无法实现自动识别)

二进制文件如图片, exe依然保持下载流程.


2: 几种后缀的支持.

后缀为 .pl .cgi .phpc 的文件, 在访问时, 将以cgi模式运行.

示例链接:

http://127.0.0.1/qampp_api/cgi.phpc

http://127.0.0.1/qampp_api/perl.pl


还有一个后缀为 .phps 默认执行源码查阅模式. 如下图:

假如你想分享自已的代码, 就可以用.phps的链接发给对方..



配置文件httpd.conf:

# 本文件禁止修改, 切记.
Include "conf/httpd-define.conf"

<ifdefine IncludeFile>
Include "conf/${IncludeFile}"
define LOG        "${LOG}IncludeFile>"
</ifdefine>

define LOG        "${LOG}httpd>"

# 加载项列表.
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_core_module modules/mod_authn_core.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_socache_module modules/mod_authn_socache.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule authz_core_module modules/mod_authz_core.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule bucketeer_module modules/mod_bucketeer.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule case_filter_module modules/mod_case_filter.so
#LoadModule case_filter_in_module modules/mod_case_filter_in.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_lock_module modules/mod_dav_lock.so
#LoadModule dbd_module modules/mod_dbd.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so

#loadmodule dav_svn_module     modules/mod_dav_svn.so
#loadmodule authz_svn_module   modules/mod_authz_svn.so

#LoadModule disk_cache_module modules/mod_disk_cache.so
#LoadModule dumpio_module modules/mod_dumpio.so
#LoadModule echo_module modules/mod_echo.so
LoadModule env_module modules/mod_env.so
#LoadModule example_module modules/mod_example.so
LoadModule expires_module modules/mod_expires.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule fcgid_module modules/mod_fcgid.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule filter_module modules/mod_filter.so
LoadModule headers_module modules/mod_headers.so
LoadModule http2_module modules/mod_http2.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
#LoadModule ldap_module modules/mod_ldap.so
LoadModule logio_module modules/mod_logio.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule cache_disk_module modules/mod_cache_disk.so
LoadModule mime_module modules/mod_mime.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule status_module modules/mod_status.so
#LoadModule substitute_module modules/mod_substitute.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
LoadModule version_module modules/mod_version.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so

#基础设置.
ServerRoot "${ServerRoot}"
ServerAdmin "${ServerAdmin}"
ServerName "${ServerName}"
DocumentRoot "${DocumentRoot}"

# 核心设置.
Timeout "${Timeout}"
KeepAlive "${KeepAlive}"
MaxKeepAliveRequests "${MaxKeepAliveRequests}"
KeepAliveTimeout "${KeepAliveTimeout}"
UseCanonicalName "${UseCanonicalName}"
AccessFileName "${AccessFileName}"
ServerTokens "${ServerTokens}"
ServerSignature "${ServerSignature}"
HostnameLookups "${HostnameLookups}"

# 给输出header 增加一些标识
Header set Qampp_Request "Server: %D %t %l %b %i"
Header set Qampp_Info "Qampp Tuesday(104979058) Apache PHP MySql FileZilla"

# 端口号配置
#Listen 0.0.0.0:80
#Listen [::]:80

<ifdefine Listen>
Listen    "${Listen}"
</ifdefine>

<ifdefine Listen1>
Listen    "${Listen1}"
</ifdefine>
<ifdefine Listen2>
Listen    "${Listen2}"
</ifdefine>
<ifdefine Listen3>
Listen    "${Listen3}"
</ifdefine>
<ifdefine Listen4>
Listen    "${Listen4}"
</ifdefine>
<ifdefine Listen5>
Listen    "${Listen5}"
</ifdefine>
<ifdefine Listen6>
Listen    "${Listen6}"
</ifdefine>
<ifdefine Listen7>
Listen    "${Listen7}"
</ifdefine>
<ifdefine Listen8>
Listen    "${Listen8}"
</ifdefine>
<ifdefine Listen9>
Listen    "${Listen9}"
</ifdefine>

# 错误日志级别.
LogLevel "${LogLevel}"

# 错误日志路径.
<ifdefine ErrorLog>
ErrorLog "${ErrorLog}"
</ifdefine>


# 解决一些崩溃现现象, 请勿修改.
AcceptFilter http none
AcceptFilter https none

# EnableMMAP 配置.
EnableMMAP off
EnableSendfile off
TraceEnable off

# note Default charset UTF8
# AddDefaultCharset utf-8

# 通用目录权限及样式.
<Directory />
    define LOG "${LOG}Directory>"         
    Options Indexes FollowSymLinks Includes ExecCGI
    indexOptions FancyIndexing ScanHTMLTitles DescriptionWidth=256 VersionSort FoldersFirst
    indexOptions IconHeight=16
    indexOptions IconWidth=16
    ServerSignature On
    AllowOverride All
    
    order allow,deny
    allow from all
    
    #Require all denied
    Require all granted
</Directory>

# 设置访问index文件名.
<IfModule dir_module>
    define LOG "${LOG}dir_module>"
    <ifdefine DirectoryIndex>
    DirectoryIndex ${DirectoryIndex}
    </ifdefine>
</IfModule>

# 禁止掉 . ~ 开头的文件访问, 比如伪静态等.
<Filesmatch "^(\.|~).*$">
    define LOG "${LOG}xFileDenied>"
    order allow,deny
    deny from all
    Require all denied
</Filesmatch>

# 日志的设置
<IfModule log_config_module>
    define LOG "${LOG}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>
      define LOG "${LOG}logio_module>"
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    
    # 访问日志路径. 有服务主机时, 会被主机替代.
    <ifdefine CustomLog>
      define LOG "${LOG}CustomLog>"
      <ifdefine CustomLog>
      CustomLog "${CustomLog}" common
      </ifdefine>
    </ifdefine>
</IfModule>

# 设置文件类型配置.
<IfModule mime_module>
    define LOG "${LOG}mime_module>"
    TypesConfig "conf/mime.types"
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType text/html .shtml
    AddType text/html .php .phps .phpc .cgi
    
    AddHandler cgi-script .cgi .pl .asp
    AddHandler application/x-httpd-php-source .phps
    AddHandler application/x-httpd-php .php
    
    AddOutputFilter INCLUDES .shtml
</IfModule>

# 一些其它设置.
<IfModule mime_magic_module>
    define LOG "${LOG}mime_magic_module>"
    MIMEMagicFile "conf/magic"
</IfModule>

<IfModule ssl_module>
    define LOG "${LOG}ssl_module>"
    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin
</IfModule>

<IfModule !mpm_netware_module>
    PidFile "logs/httpd.pid"
</IfModule>

<IfModule !mpm_winnt_module>
    <IfModule !mpm_netware_module>
        LockFile "logs/accept.lock"
    </IfModule>
</IfModule>

<IfModule mpm_winnt_module>
    define LOG "${LOG}mpm_winnt_module>"  
    ThreadsPerChild      ${MPMThreadsPerChild}
    ThreadLimit          ${MPMThreadLimit}
</IfModule>

# php模块加载设置.
define apachephppath "${AppRoot}/php"
LoadModule php${APHPVER}_module "${apachephppath}/php${APHPVER}apache2_4.dll"
PHPINIDir "${apachephppath}"
#LoadFile "${apachephppath}/php${APHPVER}ts.dll"
#LoadFile "${apachephppath}/ssleay32.dll"
#LoadFile "${apachephppath}/libeay32.dll"

# fcgid_module 的设置
<IfModule fcgid_module>
  define LOG "${LOG}fcgid_module>" 
  <filesmatch "\.phpc$">
    Options Indexes FollowSymLinks ExecCGI
    AddHandler fcgid-script .phpc 
    FcgidWrapper "${AppRoot}/php/php-cgi.exe" .phpc 
  </filesmatch>
    FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000 
    FcgidConnectTimeout 10 
    FcgidMaxProcesses 300 
    FcgidMaxProcessesPerClass 300 
    FcgidOutputBufferSize 64 
    ProcessLifeTime 0 
    FcgidMaxRequestsPerProcess 0 
    FcgidMinProcessesPerClass 0 
    FcgidFixPathinfo 0 
    FcgidProcessLifeTime 0 
    FcgidZombieScanInterval 20 
    FcgidMaxRequestLen 536870912 
    FcgidIOTimeout 120 
    FcgidTimeScore 3 
 </IfModule>

# CGI perl seting
<IfModule cgi_module>
  define LOG "${LOG}cgi_module>"
  <ifdefine ScriptLog>
    ScriptLog "${ScriptLog}"
  </ifdefine>
  Options Indexes FollowSymLinks ExecCGI
  AddHandler cgi-script .pl
  AddHandler cgi-script .cgi
</IfModule>

# 列表时的ico显示设置.
define APPiconsPath "/${AppSource}/icons/"
IndexOptions FancyIndexing HTMLTable VersionSort

AddIconByEncoding (CMP,${APPiconsPath}compress.png) x-compress x-gzip

AddIconByType (IMG,${APPiconsPath}jpeg.png) image/*
AddIconByType (SND,${APPiconsPath}sound.png) audio/*
AddIconByType (VID,${APPiconsPath}cd.png) video/*

AddIcon ${APPiconsPath}opened_folder.png ^^DIRECTORY^^
AddIcon ${APPiconsPath}blank.png ^^BLANKICON^^
AddIcon ${APPiconsPath}blank.png README

AddIcon ${APPiconsPath}text.png .txt
AddIcon ${APPiconsPath}page_white_php.png .php
AddIcon ${APPiconsPath}html.png .html .shtml .htm
AddIcon ${APPiconsPath}pdf.png .pdf
AddIcon ${APPiconsPath}compress.png .Z .z .tgz .gz .zip .tar
AddIcon ${APPiconsPath}cmd.png .exe .msi .bat .bin
AddIcon ${APPiconsPath}regedit.png .reg
AddIcon ${APPiconsPath}source_pl.png .pl .py
AddIcon ${APPiconsPath}page_white_cplusplus.png .c
AddIcon ${APPiconsPath}conf.png .conf .sh .shar .csh .ksh .tcl
AddIcon ${APPiconsPath}doc_photoshop.png .ps .ai .eps

AddIcon ${APPiconsPath}bomb.gif core
AddIcon ${APPiconsPath}back.png ..

DefaultIcon ${APPiconsPath}unknown.png

#AddDescription "GZIP compressed document" .gz
#AddDescription "tar archive" .tar
#AddDescription "GZIP compressed tar archive" .tgz
ReadmeName README.html
HeaderName HEADER.html
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t


# 语言支持设置.
AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage tr .tr
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw

LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv tr zh-CN zh-TW
ForceLanguagePriority Prefer Fallback

AddCharset us-ascii.ascii .us-ascii
AddCharset ISO-8859-1  .iso8859-1  .latin1
AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
AddCharset ISO-8859-3  .iso8859-3  .latin3
AddCharset ISO-8859-4  .iso8859-4  .latin4
AddCharset ISO-8859-5  .iso8859-5  .cyr .iso-ru
AddCharset ISO-8859-6  .iso8859-6  .arb .arabic
AddCharset ISO-8859-7  .iso8859-7  .grk .greek
AddCharset ISO-8859-8  .iso8859-8  .heb .hebrew
AddCharset ISO-8859-9  .iso8859-9  .latin5 .trk
AddCharset ISO-8859-10  .iso8859-10  .latin6
AddCharset ISO-8859-13  .iso8859-13
AddCharset ISO-8859-14  .iso8859-14  .latin8
AddCharset ISO-8859-15  .iso8859-15  .latin9
AddCharset ISO-8859-16  .iso8859-16  .latin10
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5.Big5   .big5 .b5
AddCharset cn-Big5 .cn-big5
# For russian, more than one charset is used (depends on client, mostly):
AddCharset WINDOWS-1251 .cp-1251   .win-1251
AddCharset CP866   .cp866
AddCharset KOI8  .koi8
AddCharset KOI8-E  .koi8-e
AddCharset KOI8-r  .koi8-r .koi8-ru
AddCharset KOI8-U  .koi8-u
AddCharset KOI8-ru .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-7   .utf7
AddCharset UTF-8   .utf8
AddCharset UTF-16  .utf16
AddCharset UTF-16BE .utf16be
AddCharset UTF-16LE .utf16le
AddCharset UTF-32  .utf32
AddCharset UTF-32BE .utf32be
AddCharset UTF-32LE .utf32le
AddCharset euc-cn  .euc-cn
AddCharset euc-gb  .euc-gb
AddCharset euc-jp  .euc-jp
AddCharset euc-kr  .euc-kr
#Not sure how euc-tw got in - IANA doesn't list it???
AddCharset EUC-TW  .euc-tw
AddCharset gb2312  .gb2312 .gb
AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2
AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4
AddCharset shift_jis   .shift_jis .sjis


# 以下是引入配置路径.
# XAMPP specific settings
Include "conf/extra/httpd-qampp.conf"

# Virtual hosts
Include "conf/extra/httpd-vhosts.conf"

# Qsvn
Include "conf/extra/httpd-svn.conf"

# Secure (SSL/TLS) connections
Include "conf/extra/httpd-ssl.conf"

# Add User conf connections
Include "conf/extra/httpd-user.conf"

# 最后写入日志. phpinfo中可见.
<IfDefine LOG>
SetEnv Qampp_LOG "${LOG}"
</IfDefine>



配置文件httpd-svn.conf:

LoadModule dav_svn_module "${SVNPATH}/Subversion/modules/mod_dav_svn.so"
LoadModule authz_svn_module "${SVNPATH}/Subversion/modules/mod_authz_svn.so"

<IfModule dav_svn_module>
define LOG "${LOG}dav_svn_module>"
<IfModule authz_svn_module>
define LOG "${LOG}authz_svn_module>"

<location "/qsvn">
  DAV svn
  
  AddDefaultCharset utf-8
  ForceType text/plain
  
  define LOG "${LOG}Qsvn>"
  SVNListParentPath on
  SVNParentPath "${SVNPATH}/Repositories"
  SVNIndexXSLT "/qsvnweb/svnindex.xsl"

  SVNCacheTextDeltas off
  SVNCacheFullTexts off
  SVNCacheRevProps off
  SVNAllowBulkUpdates prefer

  AuthName "${SVNAuthName}"
  AuthType Basic
  AuthBasicProvider file
  AuthUserFile "${SVNPATH}/users.conf"
  AuthzSVNReposRelativeAccessFile "authz"
  AuthzSVNGroupsFile "${SVNPATH}/groups.conf"
  ExpiresActive off
  
  Require valid-user
</location>

alias /qsvnweb "${SVNPATH}/Security"
<Directory "${SVNPATH}/Security">
AllowOverride None
Options IncludesNoExec 
Require all granted
</Directory>

<location "/qsvnweb">
  define LOG "${LOG}Qsvnweb>"
  AuthName "${SVNAuthName}"
  AuthType Basic
  AuthBasicProvider file
  AuthUserFile "${SVNPATH}/users.conf"
  ExpiresActive off
  Require valid-user
</location>

</IfModule>
</IfModule>



END


分享工作室[粤ICP备16004795号-2] 腾讯云 / 腾讯AI / 南沙新区 / 信用 0.012