Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
nginx
Search
Bert Pattyn
April 12, 2012
Technology
700
6
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
nginx
Quick introduction of nginx and the configs that a developer can use on a day by day base
Bert Pattyn
April 12, 2012
Other Decks in Technology
See All in Technology
8bit CPU 2026
koba789
7
2.9k
Microsoft MVP プログラムを紹介するから目指す人増えてくれ
tsubakimoto_s
0
140
形式手法特論:Hyperproperty とモデル検査 #kernelvm / Kernel VM Study Tokyo 19th
ytaka23
0
850
フィジカルAIの知識ゼロの僕でも AIを使えばここまでできた
tatsuya1970
0
190
サーバー常駐型の 簡易障害調査AI エージェントを作ってみた話
masayoshi
0
230
Claude Codeで開発以外の業務も爆速化しよう!
minorun365
PRO
9
8.2k
パスキーでドライブする アカウント統合(OAuth/OIDC Numa (Immersion) Workshop 2026)
oidfj
PRO
0
330
markdown-poster Introduction
kazamori
0
330
ハッカソンで入賞した話 @ Findy LT
asari194617
0
1.5k
AI駆動開発をチームに根付かせる - 「1行も書かない」チームがHarnessを育てた1年 -
kenichirokimura
3
2.9k
AIで変わるエンジニアの働き方(仮)
naoinaoi
0
580
Claude Codeの体系的な理解と知識のフック
oikon48
6
5.4k
Featured
See All Featured
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
310
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
Darren the Foodie - Storyboard
khoart
PRO
3
3.8k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
450
Music & Morning Musume
bryan
47
7.3k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Statistics for Hackers
jakevdp
799
230k
The Curse of the Amulet
leimatthew05
2
14k
Code Reviewing Like a Champion
maltzj
528
40k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
380
Transcript
None
Hi! I'm Bert.
nginx From russia with love
nginx is a combined webserver and a reverse proxy.
Why nginx? • event based -> more connections, less overhead
• efficiency • smaller memory footprint • friendly configuration format
Problems? • No support for .htaccess files • less documentation
(but enough!), growing very fast
Modules • core modules: core, events • standard http modules
• optional http modules Overview: http://wiki.nginx.org/Modules
Main configuration file /etc/nginx/nginx.conf
error_log /var/log/nginx/error.log; http { access_log /var/log/nginx/access.log; }
http { gzip on; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; }
http { include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
Default server block configuration file /etc/nginx/sites-available/default
server { listen 80; server_name www.example.be; server_name_in_redirect off; root /home/sites/default_www;
client_max_body_size 64M; }
server_name 1. full, static names www.example.be 2. names with a
wildcard at the start *.example.be 3. names with a wildcard at the end www.example.* 4. names with regex ~^www\d+\.example\.be$ 5. wildcard _
server { listen 80; server_name www.example.be; server_name_in_redirect off; root /home/sites/default_www;
client_max_body_size 64M; }
server { listen 80; server_name www.example.be; server_name_in_redirect off; root /home/sites/default_www;
client_max_body_size 64M; }
server { location ~ ^(.+\.php)(.*)$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php; } }
server { location / { if (!-e $request_filename) { rewrite
^(.*)$ /index.php last; } } }
rewrites.
server { listen 80 default; server_name _ example.be; rewrite ^(.*)
http://www.example.be$1 permanent; } server { server_name www.example.be }
server { listen 80; server_name www.example.be; rewrite ^/routebeschrijving /nl/praktisch/ routebeschrijving-and-parkeren
permanent; rewrite ^/media/(.*)$ /mp3/$1.mp3 last; rewrite_log on; }
flags 1. last (stop processing, restart search for location blocks)
2. break (stop rewrite processing, continue non-rewrite processing in current location block) 3. redirect (302) 4. permanent (301)
gzip.
server { gzip on; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; gzip_comp_level 6; gzip_types
text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js ; }
caching.
server { location ~ \.(css|js)$ { expires 31d; add_header Pragma
"public"; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } }
access.
server { location / { allow 10.1.1.0/16; deny all; }
}
test and activate changes sudo /etc/init.d/nginx reload
Other modules • Auth Basic - Basic HTTP authentication •
Browser - Interpret "User-Agent" string • SSL - HTTPS/SSL support • ...
server { valid_referers none blocked www.example.be example.be; if($invalid_referer) { return
403; } if($http_cookie ~* "id=([^;] +)(?;;|$)") { set $id $1; } if ($http_user_agent ~ MSIE) { rewrite ^(.*)$ /msie/$1 break; }
Questions?
[email protected]
bertpattyn.iswijs.be