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
6
690
nginx
Quick introduction of nginx and the configs that a developer can use on a day by day base
Bert Pattyn
April 12, 2012
Tweet
Share
Other Decks in Technology
See All in Technology
投資戦略を量産せよ 2 - マケデコセミナー(2025/12/26)
gamella
0
550
2025年の医用画像AI/AI×medical_imaging_in_2025_generated_by_AI
tdys13
0
250
Strands AgentsのEvaluatorをLangfuseにぶち込んでみた
andoooooo_bb
0
110
アプリにAIを正しく組み込むための アーキテクチャ── 国産LLMの現実と実践
kohju
1
270
業務の煩悩を祓うAI活用術108選 / AI 108 Usages
smartbank
9
18k
松尾研LLM講座2025 応用編Day3「軽量化」 講義資料
aratako
14
4.7k
Snowflake導入から1年、LayerXのデータ活用の現在 / One Year into Snowflake: How LayerX Uses Data Today
civitaspo
0
2.7k
LayerX QA Night#1
koyaman2
0
300
ECS_EKS以外の選択肢_ROSA入門_.pdf
masakiokuda
1
120
TED_modeki_共創ラボ_20251203.pdf
iotcomjpadmin
0
180
Knowledge Work の AI Backend
kworkdev
PRO
0
340
Building Serverless AI Memory with Mastra × AWS
vvatanabe
1
820
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
40k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
530
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
350
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
39
Thoughts on Productivity
jonyablonski
73
5k
We Have a Design System, Now What?
morganepeng
54
8k
Evolving SEO for Evolving Search Engines
ryanjones
0
89
Building an army of robots
kneath
306
46k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
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