インストール

バイナリ リリース

LinxuとBSDのためのあらかじめビルドされたパッケージ

ほとんどのLinuxディストリビューションとBSDの派生物は通常のパッケージリポジトリ内にNGINXを持ち、それらはソフトウェアをインストールするために通常使われるどのような方法を使ってもインストールすることができます(Debianでのapt-get、Gentooでのemerge、FreeBSDでのportsなど)。

これらのパッケージはしばしばいくらか時代遅れであることを承知してください。最新の機能とバグ修正が欲しい場合は、ソースからビルドするか直接nginx.orgからのパッケージを使うかをお勧めします。

公式の Red Hat/CentOS パッケージ

NGINXを yumリポジトリに追加するには、/etc/yum.repos.d/nginx.repoという名前のファイルを作成し、以下の設定の1つをペーストします:

CentOS:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

RHEL:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1

CentOS, RHEL および Scientific Linux $releasever 変数を入れる方法の違いにより、手動で$releasever5 (5.xの場合) あるいは 6 (6.xの場合)で置き換える必要があります。OSのバージョンに依存します。

公式の Debian/Ubuntuパッケージ

Ubuntu:

The available NGINX Ubuntu release support is listed at this distribution page. For a mapping of Ubuntu versions to release names, please visit the Official Ubuntu Releases page.

適切な stanza を /etc/apt/sources.listに追加します。If there is concern about persistence of repository additions (i.e. DigitalOcean Droplets), the appropriate stanza may instead be added to a different list file under /etc/apt/sources.list.d/, such as /etc/apt/sources.list.d/nginx.list.

## Replace $release with your corresponding Ubuntu release.
deb http://nginx.org/packages/ubuntu/ $release nginx
deb-src http://nginx.org/packages/ubuntu/ $release nginx

e.g. Ubuntu 16.04 (Xenial):

deb http://nginx.org/packages/ubuntu/ xenial nginx
deb-src http://nginx.org/packages/ubuntu/ xenial nginx

To install the packages, execute in your shell:

sudo apt-get update
sudo apt-get install nginx

If a W: GPG error: http://nginx.org/packages/ubuntu xenial Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY $key is encountered during the NGINX repository update, execute the following:

## Replace $key with the corresponding $key from your GPG error.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
sudo apt-get update
sudo apt-get install nginx

Debian 6:

適切な stanza を /etc/apt/sources.listに追加します。

deb http://nginx.org/packages/debian/ squeeze nginx
deb-src http://nginx.org/packages/debian/ squeeze nginx

Ubuntu PPA

このPPAはボランティアによって維持され、nginx.orgによっては配布されていません。それは幾つかの追加のコンパイルされたモジュールを持ち、環境により合致するかも知れません。

Launchpad上のNGINX PPA から最新の安定したNGINXバージョンを取得することができます: 以下のコマンドを実行するにはroot権限を持つ必要があるでしょう。

Ubuntu 10.04 以上について:

sudo -s
nginx=stable # use nginx=development for latest development version
add-apt-repository ppa:nginx/$nginx
apt-get update
apt-get install nginx

add-apt-repository が存在しないことについてエラーを受け取った場合は、python-software-propertiesをインストールしたいと思うでしょう。他のDebian/Ubuntu ベースのディストリビューションについては、古いパッケージセット上でほぼ動くと考えられるPPAのlucid派生を試すことができます:

sudo -s
nginx=stable # use nginx=development for latest development version
echo "deb http://ppa.launchpad.net/nginx/$nginx/ubuntu lucid main" > /etc/apt/sources.list.d/nginx-$nginx-lucid.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C
apt-get update
apt-get install nginx

公式の Win32 バイナリ

NGINX 0.8.50の時点で、NGINXは 公式のWindowsバイナリとして利用可能です。

インストレーション:

cd c:\
unzip nginx-1.2.3.zip
ren nginx-1.2.3 nginx
cd nginx
start nginx

Control:

nginx -s [ stop | quit | reopen | reload ]

問題については、c:nginxlogserror.logあるいはEventLogを見てください。

更に、Kevin Worthington は開発ブランチの早期のWindows ビルドを維持しています。

ソースのリリース

There are currently two versions of NGINX available: stable (1.10.x), mainline (1.11.x). mainlineブランチはすぐに新しい機能とバグ修正を得ますが、新しいバグも同様に導入するかも知れません。致命的なバグ修正はstableブランチにバックポートされます。

一般的に、stableリリースをお勧めしますが、mainlineリリースも一般的に安定しています。See the FAQ.

Stable

31 May 2016

Mainline

26 Jul 2016

ソースコードリポジトリは hg.nginx.org/nginxにあります。

古いバージョンはここで見つけることができます。

ソースからNGINXをビルド

ソースを解凍した後で、端末からこれらのコマンドを実行します:

./configure
make
sudo make install

デフォルトで、NGINXは/usr/local/nginxにインストールされるでしょう。You may change this and other options with the Installation and Compile-Time Options.

3rd パーティモジュールはコンパイル時にビルドされる必要があるため、それらも実施したいと思うかも知れません。

他のシステム

警告

これらのページは完璧ではありませんが、このページにあるからには多少なりとも正確さのためにレビューされています。

インストール後

There are many different example configurations that can be found in Getting Started section. Also the Pitfalls and Common Mistakes page will help keep you from making mistakes that so many users before you did.

TOP
inserted by FC2 system