SlideShare a Scribd company logo
1 of 21
WEB?
HTTPHTTP
ApacheApache
NginxNginx
HTTP
● Text based protocl defined in 1991
● V0.9 defined default port 80
● uses TCP/IP connection but should be able to run
on any connection oriented protocol
● RFCs 2616, 5785, 6266, 6585, 3986, 6874
HTTP vs. Gopher
● HTTP defines HTML as formatting for documents
● Gopher defines menu style format
● HTTP does not define any easy for searching and
indexing pages
● Trough its simple structure, gopher allows easy
search and indexing
● HTTP 80rfc2616 Gopher 70rfc1436
● Gopher defined the URI standard
HTTP
– Methods
– Requests
– Responses
– Headers
– URI/URL
– CGI
HTTP Methods
Method URI Proto
GET /lib/ana/sex.txt HTTP/1.0
● GET
● HEAD
● POST
● OPTIONS
● TRACE
● PUT
● DELETE
HTTP Requests
Method URI Proto + CRLF
HEADER + CRLF
HEADER + CRLF
CRLF
GET /pics/ana/naked.jpg HTTP/1.0 + CRLF
Range: 2400-2600,2900-3200 + CRLF
CRLF
HTTP Responses
GET /pics/ana/naked.jpg HTTP/1.0 + CRLF
Range: 2400-2600,2900-3200 + CRLF
CRLF
Proto Status Reason
HTTP/1.0 200 OK + CRLF
Response headers + CRLF
CRLF
.... binary data here .....
HTTP proto differences
● HTTP/1.0
– close connection after each request
● HTTP/1.1
– Host header
– Connection: keep-alive
– CONNECT method
Uniform Resource Identifier
(URI)
● UR Locator - URL
● Protocols: file, http, https, ftp, ftps, mailto, telnet,
ssh, smb, irc
proto :// user:pass @ host : port / path ? params
params:
param=value & param=value
Common Gateway Interface
(CGI)
● CGI is not Computer Generated Imagery :)
Web Server
Dynamic Content Generator
(CGI script)
SERVER_SOFTWARE
SERVER_NAME
GATEWAY_INTERFACESERVER_PROTOCOL
SERVER_PORT
REQUEST_METHOD
PATH_INFO - request path
PATH_TRANSLATED - full fs path
SCRIPT_NAME - request path
QUERY_STRING
REMOTE_HOST
REMOTE_ADDR
AUTH_TYPE
REMOTE_USER
REMOTE_IDENT
CONTENT_TYPE
CONTENT_LENGTH
Common Gateway Interface
(CGI)
● CGI is not Computer Generated Imagery :)
Web Server
Dynamic Content Generator
(CGI script)
/bin/sh + special
environment variables
1. Create a new environment
2. Create a new shell process
3. Execute the script
Note: the script must be executable and must
be able to produce the required output.
Responses must start with:
Content-type: some-type + CRLF
Responses may include Status codes:
200 OK + CRLF
Apache
● Documentation
● Module architecture
● Multi-processing Modules (MPMs)
● Additional Modules
MPMs - Prefork
● mpm_common
● Prefork
● Worker
● Event
Child
Child
Child
Memory
Memory
Memory
Memory
Main
Process
MPMs - Worker
● mpm_common
● Prefork
● Worker
● Event
Child
Child
Child
Main Process
Memory
MPMs - event
● mpm_common
● Prefork
● Worker
● Event
desc_ready = select(1, &rfds, NULL, NULL, &tv);
for (i=0; i <= max_fd && desc_ready > 0; ++i) {
VS.
for (;;) {
nfds = epoll_wait(epollfd, events, MAX_EVENTS, -1);
Module structure - Startup
● Pre-Config
● Test Configuration
● Post Configuration
● Open Logs
● Child Init
– Note that all of these are performed at least two times!
Module structure - Request
● Pre-Connection
● Create Connection
● Process Connection
● Create Request
● Post-Read Request
● Header Parse
● HTTP Scheme
● Default Port
● Quick Handler
● Translate Name
● Map to Storage
● Check Access
● Verify User ID
● Verify User Access
● Check Type
● Fixups
● Insert Filters
● Content Handlers
● Logging
● Insert Errors
Apache - Content handlers
module_name module_file mime_type priority
cgi_module mod_cgi.c .cgi .pl .sh 10
php_module mod_php.c .php .php5 10
perl_module mod_perl.c .pl .pm 10
Apache - CGI execution
Apache
Child mod_php
Child mod_cgi
root
nobody
nobody
Child mod_cgi
Child mod_suphp
index.php
index.php
suexec
index.php
/bin/sh
/bin/sh
suphp
index.php/bin/sh
user
user
Apache - CGI execution
Apache
Child mod_fcgid
Child mod_fcgid
root
nobody
user
index.php
FastCGI
daemon
child
child
child
index.php
index.php
suexec
Apache structure
● bin/
– httpd - the server
– ab - Apache Bench
– apxs - externel module builder
– htpasswd
– suexec
● conf/
– httpd.conf
– mime.typs + magic
● modules/ (libexec on 1.3)
● logs/

More Related Content

What's hot

Make Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDevMake Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDev
Jian-Hong Pan
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!
Michael Barker
 

What's hot (19)

Shall we play a game?
Shall we play a game?Shall we play a game?
Shall we play a game?
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
 
Profiling and optimizing go programs
Profiling and optimizing go programsProfiling and optimizing go programs
Profiling and optimizing go programs
 
Xmla4js
Xmla4jsXmla4js
Xmla4js
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)
 
Make Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDevMake Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDev
 
We shall play a game....
We shall play a game....We shall play a game....
We shall play a game....
 
The why and how of moving to php 5.4
The why and how of moving to php 5.4The why and how of moving to php 5.4
The why and how of moving to php 5.4
 
OSMC 2014: Monitoring VoIP Systems | Sebastian Damm
OSMC 2014: Monitoring VoIP Systems | Sebastian DammOSMC 2014: Monitoring VoIP Systems | Sebastian Damm
OSMC 2014: Monitoring VoIP Systems | Sebastian Damm
 
20151229 wnmp & phalcon micro app - part I
20151229 wnmp & phalcon micro app - part I20151229 wnmp & phalcon micro app - part I
20151229 wnmp & phalcon micro app - part I
 
[232]TensorRT를 활용한 딥러닝 Inference 최적화
[232]TensorRT를 활용한 딥러닝 Inference 최적화[232]TensorRT를 활용한 딥러닝 Inference 최적화
[232]TensorRT를 활용한 딥러닝 Inference 최적화
 
[232] TensorRT를 활용한 딥러닝 Inference 최적화
[232] TensorRT를 활용한 딥러닝 Inference 최적화[232] TensorRT를 활용한 딥러닝 Inference 최적화
[232] TensorRT를 활용한 딥러닝 Inference 최적화
 
The Simple Scheduler in Embedded System @ OSDC.TW 2014
The Simple Scheduler in Embedded System @ OSDC.TW 2014The Simple Scheduler in Embedded System @ OSDC.TW 2014
The Simple Scheduler in Embedded System @ OSDC.TW 2014
 
10 Most Important Features of New PHP 5.6
10 Most Important Features of New PHP 5.610 Most Important Features of New PHP 5.6
10 Most Important Features of New PHP 5.6
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war story
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!
 
Snaps on open suse
Snaps on open suseSnaps on open suse
Snaps on open suse
 
NPF scripting with Lua by Lourival Vieira Neto
NPF scripting with Lua by Lourival Vieira NetoNPF scripting with Lua by Lourival Vieira Neto
NPF scripting with Lua by Lourival Vieira Neto
 
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
 

Viewers also liked

Using Apache as an Application Server
Using Apache as an Application ServerUsing Apache as an Application Server
Using Apache as an Application Server
Phil Windley
 
Apache Web Server Architecture Chaitanya Kulkarni
Apache Web Server Architecture Chaitanya KulkarniApache Web Server Architecture Chaitanya Kulkarni
Apache Web Server Architecture Chaitanya Kulkarni
webhostingguy
 
Grammaticus (Carolus Cabanillas auctor)
Grammaticus (Carolus Cabanillas auctor)Grammaticus (Carolus Cabanillas auctor)
Grammaticus (Carolus Cabanillas auctor)
Óscar Ramos
 
educazione personalizzata Garcia Hoz
educazione personalizzata Garcia Hozeducazione personalizzata Garcia Hoz
educazione personalizzata Garcia Hoz
maeroby
 
Astrologie relationala
Astrologie relationalaAstrologie relationala
Astrologie relationala
Nicu Barbi
 
Text Message Marketing for Barber shops
Text Message Marketing for Barber shopsText Message Marketing for Barber shops
Text Message Marketing for Barber shops
Keith Carberry
 

Viewers also liked (20)

Using Apache as an Application Server
Using Apache as an Application ServerUsing Apache as an Application Server
Using Apache as an Application Server
 
Apache Web Server Architecture Chaitanya Kulkarni
Apache Web Server Architecture Chaitanya KulkarniApache Web Server Architecture Chaitanya Kulkarni
Apache Web Server Architecture Chaitanya Kulkarni
 
Autodiagnosis
AutodiagnosisAutodiagnosis
Autodiagnosis
 
Branwyn April 2013
Branwyn April 2013Branwyn April 2013
Branwyn April 2013
 
1893 12
1893 121893 12
1893 12
 
Yoga for Teeth, Ear, Nose, Throat and over all hygeine
Yoga for Teeth, Ear, Nose, Throat and over all hygeineYoga for Teeth, Ear, Nose, Throat and over all hygeine
Yoga for Teeth, Ear, Nose, Throat and over all hygeine
 
Journey Through Babudom and Netaland
Journey Through Babudom and NetalandJourney Through Babudom and Netaland
Journey Through Babudom and Netaland
 
Autolesion
AutolesionAutolesion
Autolesion
 
Autoabstract of the dissertation on topic: "Optimizing the use of financial ...
Autoabstract of the dissertation  on topic: "Optimizing the use of financial ...Autoabstract of the dissertation  on topic: "Optimizing the use of financial ...
Autoabstract of the dissertation on topic: "Optimizing the use of financial ...
 
Grammaticus (Carolus Cabanillas auctor)
Grammaticus (Carolus Cabanillas auctor)Grammaticus (Carolus Cabanillas auctor)
Grammaticus (Carolus Cabanillas auctor)
 
educazione personalizzata Garcia Hoz
educazione personalizzata Garcia Hozeducazione personalizzata Garcia Hoz
educazione personalizzata Garcia Hoz
 
The Good Oak
The Good OakThe Good Oak
The Good Oak
 
02 diagenesis
02 diagenesis02 diagenesis
02 diagenesis
 
Astrologie relationala
Astrologie relationalaAstrologie relationala
Astrologie relationala
 
Html5移动网站开发实践
Html5移动网站开发实践Html5移动网站开发实践
Html5移动网站开发实践
 
The axilla
The axillaThe axilla
The axilla
 
Cyril (vijaynagar1.ppt)
Cyril (vijaynagar1.ppt)Cyril (vijaynagar1.ppt)
Cyril (vijaynagar1.ppt)
 
Autotransfusion
AutotransfusionAutotransfusion
Autotransfusion
 
Text Message Marketing for Barber shops
Text Message Marketing for Barber shopsText Message Marketing for Barber shops
Text Message Marketing for Barber shops
 
Babyhood
BabyhoodBabyhood
Babyhood
 

Similar to LSA2 - 03 Http apache nginx

Random tips that will save your project's life
Random tips that will save your project's lifeRandom tips that will save your project's life
Random tips that will save your project's life
Mariano Iglesias
 
Apache2 BootCamp : Serving Dynamic Content with CGI
Apache2 BootCamp : Serving Dynamic Content with CGIApache2 BootCamp : Serving Dynamic Content with CGI
Apache2 BootCamp : Serving Dynamic Content with CGI
Wildan Maulana
 
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
Vorontsov, golovko   ssrf attacks and sockets. smorgasbord of vulnerabilitiesVorontsov, golovko   ssrf attacks and sockets. smorgasbord of vulnerabilities
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
DefconRussia
 
Nginx internals
Nginx internalsNginx internals
Nginx internals
liqiang xu
 

Similar to LSA2 - 03 Http apache nginx (20)

PLNOG 4: Leszek Urbański - A modern HTTP accelerator for content providers
PLNOG 4: Leszek Urbański - A modern HTTP accelerator for content providersPLNOG 4: Leszek Urbański - A modern HTTP accelerator for content providers
PLNOG 4: Leszek Urbański - A modern HTTP accelerator for content providers
 
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios CoreNagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
 
Nginx pres
Nginx presNginx pres
Nginx pres
 
03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf
03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf
03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf
 
Apache httpd reverse proxy and Tomcat
Apache httpd reverse proxy and TomcatApache httpd reverse proxy and Tomcat
Apache httpd reverse proxy and Tomcat
 
IT Operations for Web Developers
IT Operations for Web DevelopersIT Operations for Web Developers
IT Operations for Web Developers
 
Php 5.6 From the Inside Out
Php 5.6 From the Inside OutPhp 5.6 From the Inside Out
Php 5.6 From the Inside Out
 
Random tips that will save your project's life
Random tips that will save your project's lifeRandom tips that will save your project's life
Random tips that will save your project's life
 
Apache2 BootCamp : Serving Dynamic Content with CGI
Apache2 BootCamp : Serving Dynamic Content with CGIApache2 BootCamp : Serving Dynamic Content with CGI
Apache2 BootCamp : Serving Dynamic Content with CGI
 
NodeJS
NodeJSNodeJS
NodeJS
 
Securing Your Webserver By Pradeep Sharma
Securing Your Webserver By Pradeep SharmaSecuring Your Webserver By Pradeep Sharma
Securing Your Webserver By Pradeep Sharma
 
.NET @ apache.org
 .NET @ apache.org .NET @ apache.org
.NET @ apache.org
 
Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation TestingJoomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation Testing
 
(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems
 
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
Vorontsov, golovko   ssrf attacks and sockets. smorgasbord of vulnerabilitiesVorontsov, golovko   ssrf attacks and sockets. smorgasbord of vulnerabilities
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
 
"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy
 
Nginx internals
Nginx internalsNginx internals
Nginx internals
 
NS3 Overview
NS3 OverviewNS3 Overview
NS3 Overview
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 
Linux advanced concepts - Part 2
Linux advanced concepts - Part 2Linux advanced concepts - Part 2
Linux advanced concepts - Part 2
 

More from Marian Marinov

More from Marian Marinov (20)

How to implement PassKeys in your application
How to implement PassKeys in your applicationHow to implement PassKeys in your application
How to implement PassKeys in your application
 
Dev.bg DevOps March 2024 Monitoring & Logging
Dev.bg DevOps March 2024 Monitoring & LoggingDev.bg DevOps March 2024 Monitoring & Logging
Dev.bg DevOps March 2024 Monitoring & Logging
 
Basic presentation of cryptography mechanisms
Basic presentation of cryptography mechanismsBasic presentation of cryptography mechanisms
Basic presentation of cryptography mechanisms
 
Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?
 
Introduction and replication to DragonflyDB
Introduction and replication to DragonflyDBIntroduction and replication to DragonflyDB
Introduction and replication to DragonflyDB
 
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQMessage Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
 
How to successfully migrate to DevOps .pdf
How to successfully migrate to DevOps .pdfHow to successfully migrate to DevOps .pdf
How to successfully migrate to DevOps .pdf
 
How to survive in the work from home era
How to survive in the work from home eraHow to survive in the work from home era
How to survive in the work from home era
 
Managing sysadmins
Managing sysadminsManaging sysadmins
Managing sysadmins
 
Improve your storage with bcachefs
Improve your storage with bcachefsImprove your storage with bcachefs
Improve your storage with bcachefs
 
Control your service resources with systemd
 Control your service resources with systemd  Control your service resources with systemd
Control your service resources with systemd
 
Comparison of-foss-distributed-storage
Comparison of-foss-distributed-storageComparison of-foss-distributed-storage
Comparison of-foss-distributed-storage
 
Защо и как да обогатяваме знанията си?
Защо и как да обогатяваме знанията си?Защо и как да обогатяваме знанията си?
Защо и как да обогатяваме знанията си?
 
Securing your MySQL server
Securing your MySQL serverSecuring your MySQL server
Securing your MySQL server
 
Sysadmin vs. dev ops
Sysadmin vs. dev opsSysadmin vs. dev ops
Sysadmin vs. dev ops
 
DoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDKDoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDK
 
Challenges with high density networks
Challenges with high density networksChallenges with high density networks
Challenges with high density networks
 
SiteGround building automation
SiteGround building automationSiteGround building automation
SiteGround building automation
 
Preventing cpu side channel attacks with kernel tracking
Preventing cpu side channel attacks with kernel trackingPreventing cpu side channel attacks with kernel tracking
Preventing cpu side channel attacks with kernel tracking
 
Managing a lot of servers
Managing a lot of serversManaging a lot of servers
Managing a lot of servers
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 

LSA2 - 03 Http apache nginx

  • 2. HTTP ● Text based protocl defined in 1991 ● V0.9 defined default port 80 ● uses TCP/IP connection but should be able to run on any connection oriented protocol ● RFCs 2616, 5785, 6266, 6585, 3986, 6874
  • 3. HTTP vs. Gopher ● HTTP defines HTML as formatting for documents ● Gopher defines menu style format ● HTTP does not define any easy for searching and indexing pages ● Trough its simple structure, gopher allows easy search and indexing ● HTTP 80rfc2616 Gopher 70rfc1436 ● Gopher defined the URI standard
  • 4. HTTP – Methods – Requests – Responses – Headers – URI/URL – CGI
  • 5. HTTP Methods Method URI Proto GET /lib/ana/sex.txt HTTP/1.0 ● GET ● HEAD ● POST ● OPTIONS ● TRACE ● PUT ● DELETE
  • 6. HTTP Requests Method URI Proto + CRLF HEADER + CRLF HEADER + CRLF CRLF GET /pics/ana/naked.jpg HTTP/1.0 + CRLF Range: 2400-2600,2900-3200 + CRLF CRLF
  • 7. HTTP Responses GET /pics/ana/naked.jpg HTTP/1.0 + CRLF Range: 2400-2600,2900-3200 + CRLF CRLF Proto Status Reason HTTP/1.0 200 OK + CRLF Response headers + CRLF CRLF .... binary data here .....
  • 8. HTTP proto differences ● HTTP/1.0 – close connection after each request ● HTTP/1.1 – Host header – Connection: keep-alive – CONNECT method
  • 9. Uniform Resource Identifier (URI) ● UR Locator - URL ● Protocols: file, http, https, ftp, ftps, mailto, telnet, ssh, smb, irc proto :// user:pass @ host : port / path ? params params: param=value & param=value
  • 10. Common Gateway Interface (CGI) ● CGI is not Computer Generated Imagery :) Web Server Dynamic Content Generator (CGI script) SERVER_SOFTWARE SERVER_NAME GATEWAY_INTERFACESERVER_PROTOCOL SERVER_PORT REQUEST_METHOD PATH_INFO - request path PATH_TRANSLATED - full fs path SCRIPT_NAME - request path QUERY_STRING REMOTE_HOST REMOTE_ADDR AUTH_TYPE REMOTE_USER REMOTE_IDENT CONTENT_TYPE CONTENT_LENGTH
  • 11. Common Gateway Interface (CGI) ● CGI is not Computer Generated Imagery :) Web Server Dynamic Content Generator (CGI script) /bin/sh + special environment variables 1. Create a new environment 2. Create a new shell process 3. Execute the script Note: the script must be executable and must be able to produce the required output. Responses must start with: Content-type: some-type + CRLF Responses may include Status codes: 200 OK + CRLF
  • 12. Apache ● Documentation ● Module architecture ● Multi-processing Modules (MPMs) ● Additional Modules
  • 13. MPMs - Prefork ● mpm_common ● Prefork ● Worker ● Event Child Child Child Memory Memory Memory Memory Main Process
  • 14. MPMs - Worker ● mpm_common ● Prefork ● Worker ● Event Child Child Child Main Process Memory
  • 15. MPMs - event ● mpm_common ● Prefork ● Worker ● Event desc_ready = select(1, &rfds, NULL, NULL, &tv); for (i=0; i <= max_fd && desc_ready > 0; ++i) { VS. for (;;) { nfds = epoll_wait(epollfd, events, MAX_EVENTS, -1);
  • 16. Module structure - Startup ● Pre-Config ● Test Configuration ● Post Configuration ● Open Logs ● Child Init – Note that all of these are performed at least two times!
  • 17. Module structure - Request ● Pre-Connection ● Create Connection ● Process Connection ● Create Request ● Post-Read Request ● Header Parse ● HTTP Scheme ● Default Port ● Quick Handler ● Translate Name ● Map to Storage ● Check Access ● Verify User ID ● Verify User Access ● Check Type ● Fixups ● Insert Filters ● Content Handlers ● Logging ● Insert Errors
  • 18. Apache - Content handlers module_name module_file mime_type priority cgi_module mod_cgi.c .cgi .pl .sh 10 php_module mod_php.c .php .php5 10 perl_module mod_perl.c .pl .pm 10
  • 19. Apache - CGI execution Apache Child mod_php Child mod_cgi root nobody nobody Child mod_cgi Child mod_suphp index.php index.php suexec index.php /bin/sh /bin/sh suphp index.php/bin/sh user user
  • 20. Apache - CGI execution Apache Child mod_fcgid Child mod_fcgid root nobody user index.php FastCGI daemon child child child index.php index.php suexec
  • 21. Apache structure ● bin/ – httpd - the server – ab - Apache Bench – apxs - externel module builder – htpasswd – suexec ● conf/ – httpd.conf – mime.typs + magic ● modules/ (libexec on 1.3) ● logs/