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
httpd.conf programming
Search
jeffhung
April 20, 2013
Programming
1
260
httpd.conf programming
My Lightning talk in OSDC.tw 2013
jeffhung
April 20, 2013
Tweet
Share
Other Decks in Programming
See All in Programming
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.4k
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
930
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
7.8k
Alba: Why, How and What's So Interesting
okuramasafumi
0
230
Оптимизируем производительность блока Казначейство
lamodatech
0
970
HTML/CSS超絶浅い説明
yuki0329
0
200
AWS re:Invent 2024個人的まとめ
satoshi256kbyte
0
130
Scaling your build logic
antalmonori
1
120
React 19でお手軽にCSS-in-JSを自作する
yukukotani
5
580
Внедряем бюджетирование, или Как сделать хорошо?
lamodatech
0
960
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
150
為你自己學 Python
eddie
0
530
Featured
See All Featured
Building Adaptive Systems
keathley
39
2.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.6k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
510
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
Facilitating Awesome Meetings
lara
51
6.2k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The World Runs on Bad Software
bkeepers
PRO
66
11k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
Making Projects Easy
brettharned
116
6k
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.