3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

centos7 + nginx-mainline

Posted at

centos7 (aws) に nginx mainlineをinstall

Install

Repositoryの設定

nginxのDocumentの通りに実施する
http://nginx.org/en/linux_packages.html#mainline

/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

これをcentos7用に書き換える。
OS -> centos , OSRELEASE -> 7

以下は書き換えしたもの

/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1

ちゃんと読まれるか確認

$sudo yum info --enablerepo=nginx nginx
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
利用可能なパッケージ
名前                : nginx
アーキテクチャー    : x86_64
エポック            : 1
バージョン          : 1.9.4
リリース            : 1.el7.ngx
容量                : 390 k
リポジトリー        : nginx/x86_64
要約                : High performance web server
URL                 : http://nginx.org/
ライセンス          : 2-clause BSD-like license
説明                : nginx [engine x] is an HTTP and reverse proxy server, as well as
                    : a mail proxy server.

1.9.4 になってるのでOK。(2015/08/21現在)

Install

そのままyumでinstall

$ sudo yum install --enablerepo=nginx nginx
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ nginx.x86_64 1:1.9.4-1.el7.ngx を インストール
--> 依存性解決を終了しました。

依存性を解決しました

=============================================================================================================================================
 Package                       アーキテクチャー               バージョン                                 リポジトリー                   容量
=============================================================================================================================================
インストール中:
 nginx                         x86_64                         1:1.9.4-1.el7.ngx                          nginx                         390 k

トランザクションの要約
=============================================================================================================================================
インストール  1 パッケージ

総ダウンロード容量: 390 k
インストール容量: 957 k
Is this ok [y/d/N]: y
Downloading packages:
nginx-1.9.4-1.el7.ngx.x86_64.rpm                                                                                      | 390 kB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : 1:nginx-1.9.4-1.el7.ngx.x86_64                                                                               1/1
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* http://nginx.org/en/docs/

Commercial subscriptions for nginx are available on:
* http://nginx.com/products/

----------------------------------------------------------------------
  検証中                  : 1:nginx-1.9.4-1.el7.ngx.x86_64                                                                               1/1

インストール:
  nginx.x86_64 1:1.9.4-1.el7.ngx

完了しました!

Install後のバージョン確認

$ nginx -V
nginx version: nginx/1.9.4
built by gcc 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-threads --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_spdy_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'

起動してアクセス

$ sudo service nginx start
Redirecting to /bin/systemctl start  nginx.service

ブラウザでIP指定してアクセスしてみて、nginxが表示されたらとりあえずOK。

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?