UbuntuにNginxをインストール
UbuntuにNginxをインストールします。
Nginxは大量のリクエストを処理することを念頭においたWebサーバです。Webサーバとしての機能だけでなくリバースプロキシとしても使われます。
WebサーバといえばApacheかNginxを選択することになると思います。
Nginxのインストール
以下のコマンドを実行してNginxをインストールします。
user@user-VirtualBox:~$ sudo apt install nginx
NginxをインストールするとWebサーバとして起動しているはずなのでステータスを確認します。
user@user-VirtualBox:~$ 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 木 2019-08-01 14:07:15 JST; 1min 24s ago
Main PID: 2578 (nginx)
CGroup: /system.slice/nginx.service
tq2578 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
mq2580 nginx: worker process
8月 01 14:07:15 user-VirtualBox systemd[1]: Starting A high performance web server and a reverse proxy server...
8月 01 14:07:15 user-VirtualBox systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argume
8月 01 14:07:15 user-VirtualBox systemd[1]: Started A high performance web server and a reverse proxy server.
lines 1-11/11 (END)
Nginxの自動起動を設定
OSを起動したときにNginxも自動で起動するように設定します。
user@user-VirtualBox:~$ sudo systemctl enable nginx
Nginxにアクセス
ブラウザからNginxをインストールしたマシンのIPアドレスを指定してアクセスします。
> http://マシンのIPアドレス/
以下のような画面が表示されることを確認します。

以上です。
Discussion
New Comments
No comments yet. Be the first one!