SlideShare a Scribd company logo
2
Most read
ApacheCheatSheet
TheApacheHTTPServer,colloquiallycalledApache,isafreeandopen-source
cross-platformwebserversoftware,releasedunderthetermsofApacheLicense2.0.
bylam
󰅂Misc
ListVHostPrecedence
apache2ctl -S
Listactivemodules
apache2ctl -M
RewriteonFilePattern
RewriteCond %{REQUEST_F
ILENAME} (.*).(html|ht
m)$
RewriteonUserAgent
RewriteCond %{HTTP_USER
_AGENT} (iPhone|iPad)
Rewriteandaddenvironment
variabletorequest(for
examplepassalongremote
user)
RewriteRule .* - [E=PRO
XY_USER:%{LA-U:REMOTE_U
SER}]
Since2.0.49Apachehasan
exceptionhooktohandle
crashes.
EnableExceptionHook on
htaccessdoesn'twork:
AllowOverride All
environmentvariablesvia
.htaccess:
SetEnv VARNAME somevalu
e
󰅂Authentication
Skipauthenticationforcertain
URIs
Require expr %{REQUEST_
URI} =~ m#<some pattern
>#
󰅂LogRotation
PipeCustomLogtoascript:
LoadModule logio_modul
e modules/mod_logio.so
<IfModule mod_logio.c>
CustomLog "| so
me-script.sh" "%h %l %
u %t "%r" %>s %b "%
{Referer}i" "%{User-a
gent}i""
</IfModule>
DologrotationusingApaches
logrotatescript:
CustomLog "|/usr/local/
apache/bin/rotatelogs /
var/log/access_log 8640
0" common
Performlogrotationwith
cronolog:
CustomLog "|/usr/local/
sbin/cronolog /logs/%m-
%d-%Y-access.log" combi
ned
󰅂DataPrivacy
Alternativestoavoidtracking
usersbyIP:
CompletelyremoveIPs:
Replace%hinyou
LogFormatwith"-",this
ensuresalllogreading
toolscanstillparsethe
logs
Truncate/replacetheIPs
duringlogrotation.
UseapipedCustomLog
andreplacetheIPad-
hoc.HereisasimpleIPv4
onlyexamplewithsed
CustomLog"|$/bin/sed
's/^([^.].[^.].[^.].)[0-9][0-9]
(.*)$/1.02/'
>>logs/accesslog"
truncatedip
TruncatetheIPusing
rewriterules,by
extractingallbutthelast
octectoftheIPusing
RewriteCondregexand
savetheresultwiththe
lastoctectsetto0inan
envvariableina
RewriteRule,finallyuse
theenvvariableinthe
LogFormat
#Note:alsoneedsaIPv6
󰅂
Mitigatingsecurity
issues
HideServerName
ServerSignature Off
ServerTokens Prod
DisableSSLv2andSSLv3
SSLProtocol all -SSLv2
-SSLv3
DHdowngrade
openssl dhparam -out dh
params.pem 2048
󰏪
󰅢
CheatSheetMaker.com SimpleCheatSheet.com
patternRewriteCond%
{REMOTEADDR}
^(d+.d+.d+.)d+$
RewriteRule"^/.*""/$1"
[E=truncatedip:%1]
LogFormat"%
{ENV:truncatedip}%l%u
%t"%r"%>s%b…"
truncatedip
andloaditfromApache
config
SSLOpenSSLConfCmd DHPar
ameters "{path to dhpar
ams.pem}"
SaneCiphers
SSLCipherSuite
ECDHE-RSA-AES128-GCM-S
HA256:ECDHE-ECDSA-AES12
8-GCM-SHA256:ECDHE-RSA-
AES256-GCM-SHA384:ECDHE
-ECDSA-AES256-GCM-SHA38
4:DHE-RSA-AES128-GCM-SH
A256:DHE-DSS-AES128-GCM
-SHA256:kEDH+AESGCM:ECD
HE-RSA-AES128-SHA256:EC
DHE-ECDSA-AES128-SHA25
6:ECDHE-RSA-AES128-SHA:
ECDHE-ECDSA-AES128-SHA:
ECDHE-RSA-AES256-SHA38
4:ECDHE-ECDSA-AES256-SH
A384:ECDHE-RSA-AES256-S
HA:ECDHE-ECDSA-AES256-S
HA:DHE-RSA-AES128-SHA25
6:DHE-RSA-AES128-SHA:DH
E-DSS-AES128-SHA256:DHE
-RSA-AES256-SHA256:DHE-
DSS-AES256-SHA:DHE-RSA-
AES256-SHA:AES128-GCM-S
HA256:AES256-GCM-SHA38
4:AES128-SHA256:AES256-
SHA256:AES128-SHA:AES25
6-SHA:AES:CAMELLIA:DES-
CBC3-SHA:!aNULL:!eNUL
L:!EXPORT:!DES:!RC4:!MD
5:!PSK:!aECDH:!EDH-DSS-
DES-CBC3-SHA:!EDH-RSA-D
ES-CBC3-SHA:!KRB5-DES-C
BC3-SHA
SSLHonorCipherOrder
on
󰏪
󰅢

More Related Content

PDF
XamarinとAWSをつないでみた話
PDF
Retrofit library for android
POTX
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
PDF
Cake fest 2012 create a restful api
PDF
とにかく始めるClojure
PDF
Flask SQLAlchemy
PPTX
Designing CakePHP plugins for consuming APIs
PDF
Ten common mistakes made in Function Java
XamarinとAWSをつないでみた話
Retrofit library for android
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Cake fest 2012 create a restful api
とにかく始めるClojure
Flask SQLAlchemy
Designing CakePHP plugins for consuming APIs
Ten common mistakes made in Function Java

What's hot (20)

PDF
Ten common mistakes made in Function Java - iSense Java Summit
PDF
Android Libs - Retrofit
PPT
Pemrograman Jaringan
PDF
Shell Script Disk Usage Report and E-Mail Current Threshold Status
PDF
Ten mistakes functional java
PDF
Asynchronen Code testen
DOCX
Move spfile from asm to file system
PPT
Endevor api an introduction to the endevor application programming interface
PDF
Clone database using_active_duplicate
PPTX
Oracle RDBMS Workshop (Part1)
PDF
Getting Started-with-Laravel
PPTX
Cloning Oracle EBS R12: A Step by Step Procedure
PDF
Ten common mistakes made with Functional Java JBCNConf18
PPTX
Coffee at DBG- Solr introduction
PDF
Writing better functional java code - devnexus
PDF
Common mistakes functional java snyk
PDF
OWASP Proxy
PPTX
ATS Internals
KEY
Cakephp2study tips集
Ten common mistakes made in Function Java - iSense Java Summit
Android Libs - Retrofit
Pemrograman Jaringan
Shell Script Disk Usage Report and E-Mail Current Threshold Status
Ten mistakes functional java
Asynchronen Code testen
Move spfile from asm to file system
Endevor api an introduction to the endevor application programming interface
Clone database using_active_duplicate
Oracle RDBMS Workshop (Part1)
Getting Started-with-Laravel
Cloning Oracle EBS R12: A Step by Step Procedure
Ten common mistakes made with Functional Java JBCNConf18
Coffee at DBG- Solr introduction
Writing better functional java code - devnexus
Common mistakes functional java snyk
OWASP Proxy
ATS Internals
Cakephp2study tips集
Ad

Similar to Apache cheat sheet (20)

PPTX
Salesforce Integration using REST SOAP and HTTP callouts
PDF
Debugging: Rules And Tools - PHPTek 11 Version
PDF
Debugging: Rules & Tools
PDF
Apache Hacks
KEY
Java web programming
PDF
cq_cxf_integration
PDF
Java Libraries You Can’t Afford to Miss
DOC
解读server.xml文件
PDF
Relayd: a load balancer for OpenBSD
PDF
Psr 7 symfony-day
PDF
Apache and PHP: Why httpd.conf is your new BFF!
PDF
Harnessing the power of YARN with Apache Twill
PDF
Ruby HTTP clients comparison
PPTX
Understanding ASP.NET Under The Cover - Miguel A. Castro
ODP
Apache Rewrite Rules
PPTX
Rapid API development examples for Impress Application Server / Node.js (jsfw...
KEY
Load Balancing with Apache
PDF
PDF
Chap 19 web
PDF
Retrofit Library In Android
Salesforce Integration using REST SOAP and HTTP callouts
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules & Tools
Apache Hacks
Java web programming
cq_cxf_integration
Java Libraries You Can’t Afford to Miss
解读server.xml文件
Relayd: a load balancer for OpenBSD
Psr 7 symfony-day
Apache and PHP: Why httpd.conf is your new BFF!
Harnessing the power of YARN with Apache Twill
Ruby HTTP clients comparison
Understanding ASP.NET Under The Cover - Miguel A. Castro
Apache Rewrite Rules
Rapid API development examples for Impress Application Server / Node.js (jsfw...
Load Balancing with Apache
Chap 19 web
Retrofit Library In Android
Ad

More from Lam Hoang (14)

PDF
Py spark cheat sheet by cheatsheetmaker.com
PDF
VS Code cheat sheet
PDF
PostgreSql cheat sheet
PDF
Nginx cheat sheet
PDF
MySql cheat sheet
PDF
Html cheat sheet
PDF
Git cheat sheet
PDF
Django cheat sheet
PDF
Css cheat sheet
DOCX
Battle chatter minecraft 1.4.7 mod
PDF
On thi dai_hoc_mon_van_2010 (1)
PDF
ôn thi môn văn
PDF
On thi dai_hoc_mon_van_2010
PDF
giáo trình c căn bản
Py spark cheat sheet by cheatsheetmaker.com
VS Code cheat sheet
PostgreSql cheat sheet
Nginx cheat sheet
MySql cheat sheet
Html cheat sheet
Git cheat sheet
Django cheat sheet
Css cheat sheet
Battle chatter minecraft 1.4.7 mod
On thi dai_hoc_mon_van_2010 (1)
ôn thi môn văn
On thi dai_hoc_mon_van_2010
giáo trình c căn bản

Recently uploaded (20)

PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PPTX
Nature of X-rays, X- Ray Equipment, Fluoroscopy
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPTX
communication and presentation skills 01
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
PPT
Occupational Health and Safety Management System
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PPTX
Fundamentals of Mechanical Engineering.pptx
PPTX
Feature types and data preprocessing steps
PDF
Visual Aids for Exploratory Data Analysis.pdf
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PPTX
Management Information system : MIS-e-Business Systems.pptx
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PPTX
Software Engineering and software moduleing
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Nature of X-rays, X- Ray Equipment, Fluoroscopy
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
communication and presentation skills 01
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
R24 SURVEYING LAB MANUAL for civil enggi
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
Occupational Health and Safety Management System
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Fundamentals of Mechanical Engineering.pptx
Feature types and data preprocessing steps
Visual Aids for Exploratory Data Analysis.pdf
Exploratory_Data_Analysis_Fundamentals.pdf
Management Information system : MIS-e-Business Systems.pptx
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
Software Engineering and software moduleing
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS

Apache cheat sheet

  • 1. ApacheCheatSheet TheApacheHTTPServer,colloquiallycalledApache,isafreeandopen-source cross-platformwebserversoftware,releasedunderthetermsofApacheLicense2.0. bylam 󰅂Misc ListVHostPrecedence apache2ctl -S Listactivemodules apache2ctl -M RewriteonFilePattern RewriteCond %{REQUEST_F ILENAME} (.*).(html|ht m)$ RewriteonUserAgent RewriteCond %{HTTP_USER _AGENT} (iPhone|iPad) Rewriteandaddenvironment variabletorequest(for examplepassalongremote user) RewriteRule .* - [E=PRO XY_USER:%{LA-U:REMOTE_U SER}] Since2.0.49Apachehasan exceptionhooktohandle crashes. EnableExceptionHook on htaccessdoesn'twork: AllowOverride All environmentvariablesvia .htaccess: SetEnv VARNAME somevalu e 󰅂Authentication Skipauthenticationforcertain URIs Require expr %{REQUEST_ URI} =~ m#<some pattern ># 󰅂LogRotation PipeCustomLogtoascript: LoadModule logio_modul e modules/mod_logio.so <IfModule mod_logio.c> CustomLog "| so me-script.sh" "%h %l % u %t "%r" %>s %b "% {Referer}i" "%{User-a gent}i"" </IfModule> DologrotationusingApaches logrotatescript: CustomLog "|/usr/local/ apache/bin/rotatelogs / var/log/access_log 8640 0" common Performlogrotationwith cronolog: CustomLog "|/usr/local/ sbin/cronolog /logs/%m- %d-%Y-access.log" combi ned 󰅂DataPrivacy Alternativestoavoidtracking usersbyIP: CompletelyremoveIPs: Replace%hinyou LogFormatwith"-",this ensuresalllogreading toolscanstillparsethe logs Truncate/replacetheIPs duringlogrotation. UseapipedCustomLog andreplacetheIPad- hoc.HereisasimpleIPv4 onlyexamplewithsed CustomLog"|$/bin/sed 's/^([^.].[^.].[^.].)[0-9][0-9] (.*)$/1.02/' >>logs/accesslog" truncatedip TruncatetheIPusing rewriterules,by extractingallbutthelast octectoftheIPusing RewriteCondregexand savetheresultwiththe lastoctectsetto0inan envvariableina RewriteRule,finallyuse theenvvariableinthe LogFormat #Note:alsoneedsaIPv6 󰅂 Mitigatingsecurity issues HideServerName ServerSignature Off ServerTokens Prod DisableSSLv2andSSLv3 SSLProtocol all -SSLv2 -SSLv3 DHdowngrade openssl dhparam -out dh params.pem 2048 󰏪 󰅢
  • 2. CheatSheetMaker.com SimpleCheatSheet.com patternRewriteCond% {REMOTEADDR} ^(d+.d+.d+.)d+$ RewriteRule"^/.*""/$1" [E=truncatedip:%1] LogFormat"% {ENV:truncatedip}%l%u %t"%r"%>s%b…" truncatedip andloaditfromApache config SSLOpenSSLConfCmd DHPar ameters "{path to dhpar ams.pem}" SaneCiphers SSLCipherSuite ECDHE-RSA-AES128-GCM-S HA256:ECDHE-ECDSA-AES12 8-GCM-SHA256:ECDHE-RSA- AES256-GCM-SHA384:ECDHE -ECDSA-AES256-GCM-SHA38 4:DHE-RSA-AES128-GCM-SH A256:DHE-DSS-AES128-GCM -SHA256:kEDH+AESGCM:ECD HE-RSA-AES128-SHA256:EC DHE-ECDSA-AES128-SHA25 6:ECDHE-RSA-AES128-SHA: ECDHE-ECDSA-AES128-SHA: ECDHE-RSA-AES256-SHA38 4:ECDHE-ECDSA-AES256-SH A384:ECDHE-RSA-AES256-S HA:ECDHE-ECDSA-AES256-S HA:DHE-RSA-AES128-SHA25 6:DHE-RSA-AES128-SHA:DH E-DSS-AES128-SHA256:DHE -RSA-AES256-SHA256:DHE- DSS-AES256-SHA:DHE-RSA- AES256-SHA:AES128-GCM-S HA256:AES256-GCM-SHA38 4:AES128-SHA256:AES256- SHA256:AES128-SHA:AES25 6-SHA:AES:CAMELLIA:DES- CBC3-SHA:!aNULL:!eNUL L:!EXPORT:!DES:!RC4:!MD 5:!PSK:!aECDH:!EDH-DSS- DES-CBC3-SHA:!EDH-RSA-D ES-CBC3-SHA:!KRB5-DES-C BC3-SHA SSLHonorCipherOrder on 󰏪 󰅢