Ubuntuに最新のnginxをインストール

時々しかしないので忘れてしまう備忘録シリーズ

Ubuntuへ最新のnginxのインストール

PGPキーを追加

$ curl -s https://nginx.org/keys/nginx_signing.key | sudo apt-key add –

リポジトリ追加

$ sudo sh -c “cat << EOS >> /etc/apt/sources.list.d/nginx.list
deb http://nginx.org/packages/mainline/ubuntu/ `lsb_release -cs` nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ `lsb_release -cs` nginx
EOS

nginxインストール

$ sudo apt-get update && sudo apt-get install nginx

 

インストールされたバージョンやオプションを確認

$ nginx -V 2>&1 | sed ‘s/ –/\n –/g’

nginx version: nginx/1.13.4
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
built with OpenSSL 1.0.2g 1 Mar 2016
TLS SNI support enabled
configure arguments:
–prefix=/etc/nginx
–sbin-path=/usr/sbin/nginx
–modules-path=/usr/lib/nginx/modules
–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-compat
–with-file-aio
–with-threads
–with-http_addition_module
–with-http_auth_request_module
–with-http_dav_module
–with-http_flv_module
–with-http_gunzip_module
–with-http_gzip_static_module
–with-http_mp4_module
–with-http_random_index_module
–with-http_realip_module
–with-http_secure_link_module
–with-http_slice_module
–with-http_ssl_module
–with-http_stub_status_module
–with-http_sub_module
–with-http_v2_module
–with-mail
–with-mail_ssl_module
–with-stream
–with-stream_realip_module
–with-stream_ssl_module
–with-stream_ssl_preread_module
–with-cc-opt=’-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC’
–with-ld-opt=’-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,–as-needed -pie’

$ dpkg -s nginx

Package: nginx
Status: install ok installed
Priority: optional
Section: httpd
Installed-Size: 2771
Maintainer: Sergey Budnevitch <sb@nginx.com>
Architecture: amd64
Version: 1.13.4-1~xenial
Provides: httpd
Depends: libc6 (>= 2.14), libpcre3, libssl1.0.0 (>= 1.0.2~beta3), zlib1g (>= 1:1.1.4), lsb-base (>= 3.0-6), adduser
Conffiles:
/etc/default/nginx e2b1ae0f31c6d03d3305ef526b0ba3b5
/etc/default/nginx-debug 719f6f9981039a05a64c201a4b1db19f
/etc/init.d/nginx 7224be660d7c280a775bd6eca2547df4
/etc/init.d/nginx-debug 57e8f64b4f464fc13701c6b22240ac10
/etc/logrotate.d/nginx a4da44b03e39926b999329061770362b
/etc/nginx/conf.d/default.conf 411a0b28ff9b21a1cd94a6cb2ae2217d
/etc/nginx/fastcgi_params 4729c30112ca3071f4650479707993ad
/etc/nginx/koi-utf 3e338aca6a53a5420fc791b5ef86f64c
/etc/nginx/koi-win bfa0b80381fed2b1dfcf617b0ba204ec
/etc/nginx/mime.types bd837e7b34f5c9b8d89957d0527f0d44
/etc/nginx/nginx.conf f7984934bd6cab883e1f33d5129834bb
/etc/nginx/scgi_params df8c71e25e0356ffc539742f08fddfff
/etc/nginx/uwsgi_params 88ac833ee8ea60904a8b3063fde791de
/etc/nginx/win-utf 3749ffe19bedd842eb87e83d544e5ce6
Description: high performance web server
nginx [engine x] is an HTTP and reverse proxy server, as well as
a mail proxy server.
Homepage: http://nginx.org

インストールされたファイル一覧表示

$ dpkg -L nginx

/.
/etc
/etc/nginx
/etc/nginx/uwsgi_params
/etc/nginx/mime.types
/etc/nginx/win-utf
/etc/nginx/scgi_params
/etc/nginx/fastcgi_params
/etc/nginx/koi-win
/etc/nginx/koi-utf
/etc/nginx/nginx.conf
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
/etc/default
/etc/default/nginx
/etc/default/nginx-debug
/etc/init.d
/etc/init.d/nginx
/etc/init.d/nginx-debug
/etc/logrotate.d
/etc/logrotate.d/nginx
/usr
/usr/lib
/usr/lib/nginx
/usr/lib/nginx/modules
/usr/sbin
/usr/sbin/nginx
/usr/sbin/nginx-debug
/usr/share
/usr/share/nginx
/usr/share/nginx/html
/usr/share/nginx/html/50x.html
/usr/share/nginx/html/index.html
/usr/share/man
/usr/share/man/man8
/usr/share/man/man8/nginx.8.gz
/usr/share/doc
/usr/share/doc/nginx
/usr/share/doc/nginx/CHANGES.ru.gz
/usr/share/doc/nginx/README
/usr/share/doc/nginx/changelog.Debian.gz
/usr/share/doc/nginx/changelog.gz
/usr/share/doc/nginx/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/nginx
/var
/var/cache
/var/cache/nginx
/var/log
/var/log/nginx
/etc/nginx/modules

起動

$ sudo service nginx start

停止

$ sudo service nginx stop

状態確認

$ sudo service nginx status


コメント