SlideShare a Scribd company logo
1 of 45
Download to read offline
NGINX を使いこなす
基本の”キ”
NGINX TECHNICAL SOLUTIONS ARCHITECT
MATSUMOTO HIROSHI
| ©2019 F53
F5ネットワークスジャパン合同会社
NGINX Technical Solutions Architect
松本 央
| ©2019 F54
• Webサーバに対する一般的な理解
• HTTPやTCP/IPに関する基本的な知識
• ネットワークに関する基本的な理解
• Linuxコマンドラインに関する知識
CONFIDENTIAL
前提条件
| ©2019 F58
• NGINXの紹介/アーキテクチャ
• NGINXの基本設定
Agenda
Module 1
NGINXの紹介/
アーキテクチャ
| ©2019 F510
• もっとも一般的な用途について
• Free / Open Source (F/OSS) の特徴
• NGXIN Plusの特徴
• NGINXのアーキテクチャ
• NGINXの基本的なコマンドの実行
Moduleの目的
| ©2019 F511
DELIVERING MODERN APPLICATIONS AT SCALE ACROSS SEAMLESSLY ACROSS MULTI-CLOUD
NGINX Application Platform
NGINX Plus
All-In-One Software
ロードバランサー、コンテンツキャッシュ、
Webサーバ
安定、高速、高機能
必要となるリソースは最小
NGINX Controller
NGINX+統合管理ソフトウェア
NGINX+のロードバランサやAPI
Gateway、更にマルチクラウド環境に
おいても容易に管理が可能。
GUIに加えAPIでの制御が可能
NGINX Unit
NGINXが開発する新しいダイナミック
アプリケーションサーバ
OSSで提供されており、複数の
プログラミング言語をサポート。
NGINX UnitはREST APIを用いて
設定変更が可能
https://www.nginx.co.jp/products/
| ©2019 F512
DELIVERING MODERN APPLICATIONS AT SCALE ACROSS SEAMLESSLY ACROSS MULTI-CLOUD
NGINX Application Platform
NGINX Service Mesh
NGINX PlusとNGINX Controller
を基本とした、複雑なマイクロサービス
の問題を解決するシンプルな
サービスメッシュソリューション。
NGINX App Protect
アプリケーションに特化した
Web Application Firewall
NGINX+にシームレスに統合可能な
新しいWAF。 F5の実績に基づき、
高速な高品質なWAFを実現
開発中
https://www.nginx.co.jp/products/
| ©2019 F513
NGINX as a Web Server
Static Content
| ©2019 F514
NGINX as a Reverse Proxy Server
Database Server
Application Server 1
Application Server 2
| ©2019 F515
NGINX as a Load Balancer
| ©2019 F516
NGINX as a Content Cache
Cache
| ©2020 F517
https://www.nginx.co.jp/products/products-nginx/#compare-versions
F5が提供する高品質・高速WAF
| ©2019 F518
NGINX OSS – リリースサイクル
NGINX OSSは、mainline(奇数)とstable(偶数)の二種類に分かれます
毎年4月にmainlineからstableをforkします。以降のリリースVersionが新しい番号へ更新されます
NGINX Plusは、NGINX OSSと別のレポジトリで管理されています。mainlineからforkされます
NGINXはmainlineの利用を推奨しますが、更新頻度などの観点からstableの利用も可能です
1year 1year
| ©2019 F519
R16 R17 R18
NGINX Plusは、NGINXメインラインでテスト・実証された、すべてのOSS新機能を取り入れます。
NGINX Plusには、エンタープライズ向けの追加機能が含まれています。
NGINX Plusは、4ヶ月毎(4月、9月、12月)にリリースされます。
NGINX Plusは、リリースから2年間サポートされます。
NGINX Plus – リリースサイクル
4month 4month4month
| ©2019 F520
NGINXサイジング
NGINXは帯域幅または vCPU によ
るライセンス/制限を行わないため,
お客様は必要な数のインスタンスを
拡張できます。
https://www.nginx.com/resources/datasheets/ngi
nx-plus-sizing-guide/
| ©2019 F521
Processes
• Master process
• Child processes
− Cache manager
− Cache loader
− Worker processes
• Non-blocking I/O
• NGINX Reload
NGINX Plus Architecture
| ©2019 F522
Master Process
| ©2019 F523
• Cache manager
• Cache loader
• Worker processes
Child Processes
W
W
W
| ©2019 F524
Non-blocking I/O
Time
Blocking
Non-blocking
Get Account
Fetch Web Page
Get Account
Fetch Web Page
| ©2019 F525
No Downtime
Master ProcessRequest Reload
W W W
W W W
• Configuration updates
• Update NGINX binary
| ©2019 F526
• NGINX versionの表示
$ nginx -v
• config file syntaxの確認
$ nginx -t
• 現在のconfigとconfig file syntaxの確認
$ nginx -T
NGINX Commands
| ©2019 F527
• 設定の再読み込み
$ nginx -s reload
• Graceful Shutdown
$ nginx –s quit
• Fast Shutdown
$ nginx –s stop
NGINX Signals
Module 2
NGINXの基本設定
| ©2019 F529
• NGINX configuration fileの確認
• configuration fileのcontexts, blocks, について
Module 2 の目的
| ©2019 F530
• /etc/nginx/nginx.conf
• /etc/nginx/conf.d/default.conf
Configuration File Locations
| ©2019 F531
Directive: NGINXの動作を規定する
• 文末はセミコロン「;」をつける
Block – Directiveをまとめたもの
• 中括弧「{}」で囲う
Directives
server {
listen 80;
root /usr/share/nginx/html;
}
Server Block
Start
Listen
Directive
Root
Directive
End of Server Block
| ©2019 F532
EXAMPLES OF LISTEN DIRECTIVE PARAMETERS:
Directive Parameters
listen 443 ssl;
#Defines an HTTPS server on port 443
listen 443 ssl http2;
#Allows HTTP/2 protocol for client HTTP requests
listen 53 udp;
#Defines UDP protocol for all port 53 traffic
| ©2019 F533
NGINX Configは、main, HTTPな
どのコンテキストを持つ
利用者が主に操作する場所は、
• Server context
• Location context
Configuration Contexts
| ©2019 F534
• 最上位のdirectives
• 記載内容の例
−worker processesの数
−NGINXののLinux username
−File配置場所
−Error log
−Process ID (PID)
Main Context
| ©2019 F535
• connection processing
directivesを記述
• 記載内容の例
−worker processごとに処理す
るコネクション数の指定
• 基本的にDefault値を使用
する
Events Context
| ©2019 F536
• NGINXがどのようにHTTP
やHTTPSのconnectionを処
理するか定義
• log formatsや、locationの指
定
• include directiveを用いて
conf.dよりconfig fileのロー
ドをすることが可能
HTTP Context
| ©2019 F537
リクエストに応答するための
virtual serverを定義
• Domain name
• IP address
• Unix socket
Server Context
| ©2019 F538
HTTP requestを更にどのように取
り扱うか定義
• request URIを基に定義
• pathを指定
• requestのPath文字列を一致をもとに
制御
Location Context
| ©2019 F539
継承
| ©2019 F540
継承の例
http {
index index.html;
server {
listen 80;
root /usr/home/share/nginx/html;
}
server {
listen 8080;
root /test/home/html;
index main.html
}
}
| ©2019 F541
include Directive
http {
...
include /etc/nginx/conf.d/*.conf
}
etc
nginx
conf.d
簡単なデモ
設定ファイルの基本書式
| ©2019 F543
NGINX Configuration File
http {
log_format main ‘$remote_addr - **省略** ;
access_log /var/log/nginx/access.log main;
index index.html index.htm;
include /etc/nginx/conf.d/*.conf;
}
nginx
conf.d
server {
listen 8080;
root /usr/share/nginx/html/demo;
index demo.html;
}
demo.conf
default.conf
Main
HTTP
Server
Directory
Directive
まとめ
| ©2019 F545
以下のご紹介をいたしました。
• NGINXの紹介/アーキテクチャ
• NGINXの基本設定
まとめ
| ©2019 F546
その他参考情報
| ©2019 F547
NGINX Documents / Contents
https://nginx.com/ https://docs.nginx.com/
RESOURCE BLOG
https://nginx.co.jp/
リソース ブログ
https://nginx.org/en/docs/
https://nginx.org/en/docs/dirindex.html
| ©2019 F548
お問い合わせフォーム
• 製品に関するお問い合わせ
• 購入に関するお問い合わせ
• 構成・設計に関するご相談
など
https://www.nginx.co.jp/contact-sales/
お気軽にお問い合わせください
Thank You!

More Related Content

Featured

Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...Palo Alto Software
 
9 Tips for a Work-free Vacation
9 Tips for a Work-free Vacation9 Tips for a Work-free Vacation
9 Tips for a Work-free VacationWeekdone.com
 

Featured (20)

Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...
 
9 Tips for a Work-free Vacation
9 Tips for a Work-free Vacation9 Tips for a Work-free Vacation
9 Tips for a Work-free Vacation
 

NGINX基本のキ_F5-NGINX_Community-20200805

  • 1. NGINX を使いこなす 基本の”キ” NGINX TECHNICAL SOLUTIONS ARCHITECT MATSUMOTO HIROSHI
  • 3. | ©2019 F54 • Webサーバに対する一般的な理解 • HTTPやTCP/IPに関する基本的な知識 • ネットワークに関する基本的な理解 • Linuxコマンドラインに関する知識 CONFIDENTIAL 前提条件
  • 4. | ©2019 F58 • NGINXの紹介/アーキテクチャ • NGINXの基本設定 Agenda
  • 6. | ©2019 F510 • もっとも一般的な用途について • Free / Open Source (F/OSS) の特徴 • NGXIN Plusの特徴 • NGINXのアーキテクチャ • NGINXの基本的なコマンドの実行 Moduleの目的
  • 7. | ©2019 F511 DELIVERING MODERN APPLICATIONS AT SCALE ACROSS SEAMLESSLY ACROSS MULTI-CLOUD NGINX Application Platform NGINX Plus All-In-One Software ロードバランサー、コンテンツキャッシュ、 Webサーバ 安定、高速、高機能 必要となるリソースは最小 NGINX Controller NGINX+統合管理ソフトウェア NGINX+のロードバランサやAPI Gateway、更にマルチクラウド環境に おいても容易に管理が可能。 GUIに加えAPIでの制御が可能 NGINX Unit NGINXが開発する新しいダイナミック アプリケーションサーバ OSSで提供されており、複数の プログラミング言語をサポート。 NGINX UnitはREST APIを用いて 設定変更が可能 https://www.nginx.co.jp/products/
  • 8. | ©2019 F512 DELIVERING MODERN APPLICATIONS AT SCALE ACROSS SEAMLESSLY ACROSS MULTI-CLOUD NGINX Application Platform NGINX Service Mesh NGINX PlusとNGINX Controller を基本とした、複雑なマイクロサービス の問題を解決するシンプルな サービスメッシュソリューション。 NGINX App Protect アプリケーションに特化した Web Application Firewall NGINX+にシームレスに統合可能な 新しいWAF。 F5の実績に基づき、 高速な高品質なWAFを実現 開発中 https://www.nginx.co.jp/products/
  • 9. | ©2019 F513 NGINX as a Web Server Static Content
  • 10. | ©2019 F514 NGINX as a Reverse Proxy Server Database Server Application Server 1 Application Server 2
  • 11. | ©2019 F515 NGINX as a Load Balancer
  • 12. | ©2019 F516 NGINX as a Content Cache Cache
  • 14. | ©2019 F518 NGINX OSS – リリースサイクル NGINX OSSは、mainline(奇数)とstable(偶数)の二種類に分かれます 毎年4月にmainlineからstableをforkします。以降のリリースVersionが新しい番号へ更新されます NGINX Plusは、NGINX OSSと別のレポジトリで管理されています。mainlineからforkされます NGINXはmainlineの利用を推奨しますが、更新頻度などの観点からstableの利用も可能です 1year 1year
  • 15. | ©2019 F519 R16 R17 R18 NGINX Plusは、NGINXメインラインでテスト・実証された、すべてのOSS新機能を取り入れます。 NGINX Plusには、エンタープライズ向けの追加機能が含まれています。 NGINX Plusは、4ヶ月毎(4月、9月、12月)にリリースされます。 NGINX Plusは、リリースから2年間サポートされます。 NGINX Plus – リリースサイクル 4month 4month4month
  • 16. | ©2019 F520 NGINXサイジング NGINXは帯域幅または vCPU によ るライセンス/制限を行わないため, お客様は必要な数のインスタンスを 拡張できます。 https://www.nginx.com/resources/datasheets/ngi nx-plus-sizing-guide/
  • 17. | ©2019 F521 Processes • Master process • Child processes − Cache manager − Cache loader − Worker processes • Non-blocking I/O • NGINX Reload NGINX Plus Architecture
  • 19. | ©2019 F523 • Cache manager • Cache loader • Worker processes Child Processes W W W
  • 20. | ©2019 F524 Non-blocking I/O Time Blocking Non-blocking Get Account Fetch Web Page Get Account Fetch Web Page
  • 21. | ©2019 F525 No Downtime Master ProcessRequest Reload W W W W W W • Configuration updates • Update NGINX binary
  • 22. | ©2019 F526 • NGINX versionの表示 $ nginx -v • config file syntaxの確認 $ nginx -t • 現在のconfigとconfig file syntaxの確認 $ nginx -T NGINX Commands
  • 23. | ©2019 F527 • 設定の再読み込み $ nginx -s reload • Graceful Shutdown $ nginx –s quit • Fast Shutdown $ nginx –s stop NGINX Signals
  • 25. | ©2019 F529 • NGINX configuration fileの確認 • configuration fileのcontexts, blocks, について Module 2 の目的
  • 26. | ©2019 F530 • /etc/nginx/nginx.conf • /etc/nginx/conf.d/default.conf Configuration File Locations
  • 27. | ©2019 F531 Directive: NGINXの動作を規定する • 文末はセミコロン「;」をつける Block – Directiveをまとめたもの • 中括弧「{}」で囲う Directives server { listen 80; root /usr/share/nginx/html; } Server Block Start Listen Directive Root Directive End of Server Block
  • 28. | ©2019 F532 EXAMPLES OF LISTEN DIRECTIVE PARAMETERS: Directive Parameters listen 443 ssl; #Defines an HTTPS server on port 443 listen 443 ssl http2; #Allows HTTP/2 protocol for client HTTP requests listen 53 udp; #Defines UDP protocol for all port 53 traffic
  • 29. | ©2019 F533 NGINX Configは、main, HTTPな どのコンテキストを持つ 利用者が主に操作する場所は、 • Server context • Location context Configuration Contexts
  • 30. | ©2019 F534 • 最上位のdirectives • 記載内容の例 −worker processesの数 −NGINXののLinux username −File配置場所 −Error log −Process ID (PID) Main Context
  • 31. | ©2019 F535 • connection processing directivesを記述 • 記載内容の例 −worker processごとに処理す るコネクション数の指定 • 基本的にDefault値を使用 する Events Context
  • 32. | ©2019 F536 • NGINXがどのようにHTTP やHTTPSのconnectionを処 理するか定義 • log formatsや、locationの指 定 • include directiveを用いて conf.dよりconfig fileのロー ドをすることが可能 HTTP Context
  • 33. | ©2019 F537 リクエストに応答するための virtual serverを定義 • Domain name • IP address • Unix socket Server Context
  • 34. | ©2019 F538 HTTP requestを更にどのように取 り扱うか定義 • request URIを基に定義 • pathを指定 • requestのPath文字列を一致をもとに 制御 Location Context
  • 36. | ©2019 F540 継承の例 http { index index.html; server { listen 80; root /usr/home/share/nginx/html; } server { listen 8080; root /test/home/html; index main.html } }
  • 37. | ©2019 F541 include Directive http { ... include /etc/nginx/conf.d/*.conf } etc nginx conf.d
  • 39. | ©2019 F543 NGINX Configuration File http { log_format main ‘$remote_addr - **省略** ; access_log /var/log/nginx/access.log main; index index.html index.htm; include /etc/nginx/conf.d/*.conf; } nginx conf.d server { listen 8080; root /usr/share/nginx/html/demo; index demo.html; } demo.conf default.conf Main HTTP Server Directory Directive
  • 41. | ©2019 F545 以下のご紹介をいたしました。 • NGINXの紹介/アーキテクチャ • NGINXの基本設定 まとめ
  • 43. | ©2019 F547 NGINX Documents / Contents https://nginx.com/ https://docs.nginx.com/ RESOURCE BLOG https://nginx.co.jp/ リソース ブログ https://nginx.org/en/docs/ https://nginx.org/en/docs/dirindex.html
  • 44. | ©2019 F548 お問い合わせフォーム • 製品に関するお問い合わせ • 購入に関するお問い合わせ • 構成・設計に関するご相談 など https://www.nginx.co.jp/contact-sales/ お気軽にお問い合わせください