Your SlideShare is downloading. ×
Web   лекция 3 Web серверы
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Web лекция 3 Web серверы

223
views

Published on

Web серверы

Web серверы

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
223
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Web-сервера Сергей Лихобабин, Александр Горный
  • 2. 2 Конфигурация Обзор лекции: web-сервера
  • 3. 3 • Directive Value • #comment • <Directive Value> </Directive> • Include FileMask Структура httpd.conf
  • 4. 4 • PidFile • User/Group • Listen • ListenBacklog • Protocol • CoreDumpDirectory Верхнеуровневые параметры
  • 5. 5 • Модуль mod_so • Директива LoadModule Модули
  • 6. 6 • prefork • worker • event Multi-Processing Modules
  • 7. 7 • StartServers • MinSpareServers/MaxSpareServers • MaxRequestWorkers • MaxConnectionsPerChild prefork Процессов не больше MaxRequestWorkers Потоков по одному на процесс Клиентов не больше MaxRequestWorkers
  • 8. 8 • ThreadsPerChild • MinSpareThreads/MaxSpareThreads worker Процессов не больше MaxRequestWorkers/ThreadPerChild Потоков не больше MaxRequestWorkers Клиентов не больше MaxRequestWorkers
  • 9. 9 • AsyncRequestWorkerFactor event Процессов не больше MaxRequestWorkers/ThreadPerChild Потоков ThreadPerChild + 1 на процесс Клиентов не больше (AsyncRequestWorkerFactor + 1) * MaxRequestWorkers
  • 10. 10 • KeepAlive • KeepAliveTimeout • MaxKeepAliveRequests • TimeOut • RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500 KeepAlive и TimeOut’ы
  • 11. 11 • VirtualHost • ServerName • ServerAlias VirtualHost
  • 12. 12 • Directory/DirectoryMatch • Location/LocationMatch • Files/FilesMatch • Options ExecCGI, Includes, Indexes, FollowSymLinks Структура
  • 13. 13 • AccessFileName • AllowOverride/AllowOverrideList .htaccess
  • 14. 14 • DocumentRoot • Alias/AliasMatch • ScriptAlias/ScriptAliasMatch • UserDir Добраться до файлов
  • 15. 15 • ErrorLog • ErrorLogFormat • LogLevel • LogFormat • CustomLog/TransferLog 176.195.177.189 - - [02/Mar/2014:22:37:35 +0400] "GET /oborudovanie/pnevmaticheskie- zaglushki/ HTTP/1.0" 200 "http://yandex.ru/yandsearch?text=%D1%8F%D1%8D%D1%85%D1%82%D1%8C%D1%8E%D1% 87%D1%80%D1%83%D1%8B%D1%94%C2%B0%D1%8A%D1%88&lr=213" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)" 80.76.108.27 - - [02/Mar/2014:23:24:59 +0400] "GET /webasyst/?action=count&background_process=1&_=1393788297367 HTTP/1.0" 200 "http://attivo.ru/webasyst/shop/?action=orders" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36" Логи
  • 16. 16 • SetHandler default-handler, cgi-script, <my-handler> • AddHandler/RemoveHandler • Action handler
  • 17. 17 • Redirect/RedirectMatch • ErrorDocument code page • RewriteEngine on • RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'“ • RewriteRule ^/$ /homepage.std.html mod_rewrite
  • 18. 18 Авторизация
  • 19. 19 • LimitRequestBody • LimitRequestFields • LimitRequestFieldsSize • LimitRequestLine • Rlimit* Ограничения клиента и сервера
  • 20. 20 • If, ElseIf, Else • IfModule • IfDefine • IfVersion • Error Apache: if
  • 21. 21 Вопросы
  • 22. 22 • Directive Value • #comment • <Directive Value> </Directive> • Include FileMask Структура httpd.conf
  • 23. 23 • directive value; • #comment • directive value { } • include filemask Структура nginx.conf
  • 24. 24 • PidFile • User/Group • Listen • ListenBacklog • Protocol • CoreDumpDirectory Верхнеуровневые параметры (Apache)
  • 25. 25 • pid • user • working_directory Верхнеуровневые параметры
  • 26. 26 • prefork • worker • event Multi-Processing Modules (Apache)
  • 27. 27 • use • worker_processes • worker_connections events Процессов Ровно worker_processes Потоков нет Клиентов не больше worker_connections*worker_processes
  • 28. 28 • debug_connection • timer_resolution • worker_cpu_affinity Производительность
  • 29. 29 • Directory/DirectoryMatch • Location/LocationMatch • Files/FilesMatch • Options ExecCGI, Includes, Indexes, FollowSymLinks Структура (Apache)
  • 30. 30 • http • server • location • И никакого .htaccess!! Структура
  • 31. 31 • KeepAlive • KeepAliveTimeout • MaxKeepAliveRequests • TimeOut • RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500 KeepAlive и TimeOut’ы (Apache)
  • 32. 32 • keepalive_disable none|msie6|safari • keepalive_timeout timeout [header] • keepalive_requests • client_body_timeout, client_header_timeout, resolver_timeout, send_timeout, keep_alive и time_out’ы
  • 33. 33 • VirtualHost • ServerName • ServerAlias VirtualHost (Apache)
  • 34. 34 • server {} • server_name • listen Сервера
  • 35. 35 • DocumentRoot • Alias/AliasMatch • ScriptAlias/ScriptAliasMatch • UserDir Добраться до файлов (Apache)
  • 36. 36 • root Добраться до файлов • empty_gif • random_index
  • 37. 37 • ErrorLog • ErrorLogFormat • LogLevel • LogFormat • CustomLog/TransferLog 176.195.177.189 - - [02/Mar/2014:22:37:35 +0400] "GET /oborudovanie/pnevmaticheskie- zaglushki/ HTTP/1.0" 200 "http://yandex.ru/yandsearch?text=%D1%8F%D1%8D%D1%85%D1%82%D1%8C%D1%8E%D1% 87%D1%80%D1%83%D1%8B%D1%94%C2%B0%D1%8A%D1%88&lr=213" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)" 80.76.108.27 - - [02/Mar/2014:23:24:59 +0400] "GET /webasyst/?action=count&background_process=1&_=1393788297367 HTTP/1.0" 200 "http://attivo.ru/webasyst/shop/?action=orders" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36" Логи (Apache)
  • 38. 38 • error_log • access_log • log_format 176.195.177.189 - - [02/Mar/2014:22:37:35 +0400] "GET /oborudovanie/pnevmaticheskie- zaglushki/ HTTP/1.0" 200 "http://yandex.ru/yandsearch?text=%D1%8F%D1%8D%D1%85%D1%82%D1%8C%D1%8E%D1% 87%D1%80%D1%83%D1%8B%D1%94%C2%B0%D1%8A%D1%88&lr=213" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)" 80.76.108.27 - - [02/Mar/2014:23:24:59 +0400] "GET /webasyst/?action=count&background_process=1&_=1393788297367 HTTP/1.0" 200 "http://attivo.ru/webasyst/shop/?action=orders" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36" Логи
  • 39. 39 • Redirect/RedirectMatch • ErrorDocument code page • RewriteEngine on • RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'“ • RewriteRule ^/$ /homepage.std.html mod_rewrite (Apache)
  • 40. 40 • rewrite from to [redirect|permanent|break|last] • error_page code page • return code ngx_http_rewrite_module
  • 41. 41 Авторизация (Apache)
  • 42. 42 Авторизация ngx_http_auth_request_module
  • 43. 43 proxy • proxy_pass • proxy_cache_valid • proxy_cache_key • proxy_cache_min_uses • 12 proxy_* директив про пути и размеры буферов • 4 proxy_* директивы про timeout
  • 44. 44 upstream
  • 45. 45 ngx_http_memcached_module И, конечно, одна директива про размер буфера и две директивы про timeout
  • 46. 46 • LimitRequestBody • LimitRequestFields • LimitRequestFieldsSize • LimitRequestLine • Rlimit* Ограничения клиента и сервера (apache)
  • 47. 47 • client_max_body_size • large_client_header_buffers • worker_rlimit_* • limit_rate Ограничения клиента и сервера
  • 48. 48 ngx_http_limit_req_module
  • 49. 49 Ограничение скорости • limit_rate • limit_rate_after
  • 50. 50 • If, ElseIf, Else • IfModule • IfDefine • IfVersion • Error If (Apache)
  • 51. 51 • if • set • perl if
  • 52. 52 Вопросы
  • 53. Спасибо за внимание! Александр Горный, gornyi@corp.mail.ru Сергей Лихобабин, s.lihobabin@corp.mail.ru