1
1

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 1 year has passed since last update.

Ubuntu 22.04 - Nginx インストール

Last updated at Posted at 2022-11-29

環境

Ubuntu 22.04 LTS
Nginx 1.18.0

設定

Nginx インストール

$ sudo apt update
$ sudo apt install nginx

Firewall の設定

Firewall の設定を忘れることなかれ。ufwが認識しているアプリケーション構成を確認しておく。

$ sudo ufw app list
Available applications:
  Nginx Full
  Nginx HTTP
  Nginx HTTPS
  OpenSSH

とりあえず、Full で許可する。

$ sudo ufw allow 'Nginx Full'
$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
Nginx Full                 ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)
Nginx Full (v6)            ALLOW       Anywhere (v6)

Web サーバの確認

active (running)になっていればOK

$ sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-11-29 11:08:00 UTC; 4min 12s ago
       Docs: man:nginx(8)
    Process: 3618 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 3620 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 3738 (nginx)
      Tasks: 2 (limit: 1033)
     Memory: 4.1M
        CPU: 30ms
     CGroup: /system.slice/nginx.service
             tq3738 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
             mq3741 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >

Web ブラウザからアクセス

http://X.X.X.X:80 をたたいてみる。次のように表示されたら完了。
image.png

Nginx のバージョン

確認しておく。んー。最新じゃない。最新にする方法は次の記事で。

$ nginx -v
nginx version: nginx/1.18.0 (Ubuntu)
1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?