$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
httpd.conf programming
Search
jeffhung
April 20, 2013
Programming
1
320
httpd.conf programming
My Lightning talk in OSDC.tw 2013
jeffhung
April 20, 2013
Tweet
Share
Other Decks in Programming
See All in Programming
Atomics APIを知る / Understanding Atomics API
ssssota
1
240
モデル駆動設計をやってみよう Modeling Forum2025ワークショップ/Let’s Try Model-Driven Design
haru860
0
210
手軽に積ん読を増やすには?/読みたい本と付き合うには?
o0h
PRO
1
130
Level up your Gemini CLI - D&D Style!
palladius
1
150
分散DBって何者なんだ... Spannerから学ぶRDBとの違い
iwashi623
0
160
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
250
JJUG CCC 2025 Fall: Virtual Thread Deep Dive
ternbusty
3
510
dotfiles 式年遷宮 令和最新版
masawada
1
440
2025 컴포즈 마법사
jisungbin
0
160
S3 VectorsとStrands Agentsを利用したAgentic RAGシステムの構築
tosuri13
4
240
Microservices Platforms: When Team Topologies Meets Microservices Patterns
cer
PRO
1
810
乱雑なコードの整理から学ぶ設計の初歩
masuda220
PRO
32
15k
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
How GitHub (no longer) Works
holman
316
140k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.3k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
990
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Unsuck your backbone
ammeep
671
58k
It's Worth the Effort
3n
187
29k
Typedesign – Prime Four
hannesfritz
42
2.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.4k
Transcript
httpd.conf programming OSDC.tw 2013
@jeffhung • www.jeffhung.net/blog • Trend Micro Developer • Hadoop, Big
Data • and.. PaaS
PaaS?
Platform as a Service
Google AppEngine
TCloud, 2010
The Path to Pass into PasS Talk @ OSDC.tw 2011
Dispatcher MySQL& Database& MySQL& Database& MySQL& Database& MySQL& Database& Java&Web&
Container& Java&Web& Container& Java&Web& Container& Java&Web& Container& Hadoop& HBase& Hadoop& HBase& Hadoop& HBase& Hadoop& HBase& Lucene& Indexer& Lucene& Indexer& Lucene& Indexer& Search& Engine& Elaster&CAP&Service& (API&Server)& Elaster&CAP&Service& (API&Server)& Elaster&CAP&Service& (API&Server)& Elaster&CAP&Service& (API&Server)& api.elasterlabs.com.tw *.app.elasterlabs.com.tw Internet& Balancer Manage&
nginx
ZooKeeper
Lots of Java codes to implement the agents to control
nginx according to routing rules subscribed from ZK
Jserv: 㑌ཁሜҰ ࡞ۀܥ౷
lunastorm: 㑌ཁሜ Ұ message system
jeffhung: 㑌ཁሜҰ PaaS
20 RD + 6 months to built Elaster CAP
5 RD + 6 weeks to bootstrap a private PaaS
for our own
How?
We have a strong OPS team
do more with less don’t code anything
Apache HTTPd ++
Dispatcher done in httpd.conf
If it works, it works.
Bug? It’s apache’s fault
Redis replaces ZK
Apache replaces nginx
Glue together with httpd.conf
httpd.conf programming
function REDIS (cmd) { ... } # Call REDIS()?
# function REDIS (cmd) { ... } RewriteMap REDIS "prg:redis-cli
--raw" # Call REDIS()? ${REDIS:cmd}
if url == "/index.html" redirect "/404.html" else if proxy "/app/...",
"http://app/REDIS(app)"
# function REDIS (cmd) { ... } RewriteMap REDIS "prg:redis-cli
--raw" # if url == "/index.html" # redirect "/404.html" RewriteRule ^/index.html /404.html [L,P] # else if # proxy "/app/...", "http://app/REDIS(app)" RewriteRule ^([^\/]*)/(.*) ${REDIS:GET\ $1}/$2 [L,P]
Live Demo simplified https://github.com/jeffhung/osdc-2013-lightning
The Actual httpd.conf • Authentication & Authorization • Customer Header
Injection • Dispatching & Load Balancing
~200 lines of httpd.conf And several filter scripts
~200 lines of httpd.conf And several filter scripts dash2under.pl: #!/usr/bin/perl
$| = 1; # Turn off I/O buffering while (<STDIN>) { s/-/_/g; # Replace dashes with underscores print $_; }
If it works, it works.