Ubuntu 12.04LTSにnginxをインストールする方法

当ページのリンクには広告が含まれています。

スポンサーリンク

Ubuntu 12.04LTSにnginxをインストールする方法を解説します。

Ubuntuパッケージのnginx

Ubuntuパッケージには、いくつかのnginxが用意されています。aptitudeコマンドを使って、用途にあったnginxのパッケージ名を確認してみましょう。

# aptitude search nginx
p   nginx                                     - small, but very powerful and efficient web server an
v   nginx:i386                                -                                                     
p   nginx-common                              - small, but very powerful and efficient web server (c
p   nginx-doc                                 - small, but very powerful and efficient web server (d
p   nginx-extras                              - nginx web server with full set of core modules and e
p   nginx-extras:i386                         - nginx web server with full set of core modules and e
p   nginx-extras-dbg                          - Debugging symbols for nginx (extras)                
p   nginx-extras-dbg:i386                     - Debugging symbols for nginx (extras)                
p   nginx-full                                - nginx web server with full set of core modules      
p   nginx-full:i386                           - nginx web server with full set of core modules      
p   nginx-full-dbg                            - Debugging symbols for nginx (full)                  
p   nginx-full-dbg:i386                       - Debugging symbols for nginx (full)                  
p   nginx-light                               - nginx web server with minimal set of core modules   
p   nginx-light:i386                          - nginx web server with minimal set of core modules   
p   nginx-light-dbg                           - Debugging symbols for nginx (light)                 
p   nginx-light-dbg:i386                      - Debugging symbols for nginx (light)                 
p   nginx-naxsi                               - nginx web server with naxsi 0.44 included           
p   nginx-naxsi:i386                          - nginx web server with naxsi 0.44 included           
p   nginx-naxsi-dbg                           - Debugging symbols for nginx (naxsi)                 
p   nginx-naxsi-dbg:i386                      - Debugging symbols for nginx (naxsi)  

組み込まれているモジュールによっていくつかのパッケージが用意されています。「nginx」「nginx-light」「nginx-full」「nginx-extras」「nginx-naxsi」の5つですね。「nginx」は、「nginx-full」のダミーパッケージなので、実際は4つです。それではひとつひとつみてみましょう。

・nginx-light
最小セットのコアモジュールが組み込まれたパッケージです。

# aptitude show nginx-light
…
Description: nginx web server with minimal set of core modules
…
 This package provides a very light version of Nginx which lacks many of the features and modules of
 it's full counterpart.

・nginx-full
フルセットのコアモジュールが組み込まれたパッケージです。

# aptitude show nginx-full
…
Description: nginx web server with full set of core modules
…
 It can also act as a POP3/IMAP mail proxy with SSL and TLS SNI support. This package has the
 standard set of modules enabled. 

・nginx-extras
フルセットのコアモジュール + 拡張モジュール組み込まれたパッケージです。

# aptitude show nginx-extras
…
Description: nginx web server with full set of core modules and extras
…
 This package provides the standard version of Nginx. It also includes extra features and modules
 such as the perl module which allows the addition of perl in configuration files. 

・nginx-extras
フルセットのコアモジュールにWebアプリケーションのファイアウォールnaxsiが組み込まれたパッケージです。

# aptitude show nginx-naxsi
…
Description: nginx web server with naxsi 0.44 included
…
 This package provides the standard version of Nginx, including the naxsi Web Application Firewall. 

Ubuntuパッケージからインストール

ここでは、いろいろなモジュールが組み込まれている「nginx-extras」をインストールします。

# aptitude install nginx-extras

nginxを起動します。

# service nginx start

ブラウザでサーバーへアクセスしてみましょう。

ubuntu-nginx-install

「Welcome to nginx!」というシンプルなメッセージが表示されれば、OKです。

nginx の人気記事

  1. sudoユーザーを追加する方法
  2. nginxの設定と使い方
  3. nginxとApacheの性能比較
  4. PHP-FPM - server reached pm.max_children - Warningエラー対処法

関連記事(一部広告含む)