3
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?

nginxの再インストール

Posted at

調べてもあんまり的確な答えが出てこなかったので、備忘録的な感じで記事にしました。

動作環境

Webarena IndigoのVPSを使用
OSはUbuntu 20.04 (x86_64)

nginxを停止+削除

sudo systemctl stop nginx #停止
sudo rm -f -R /usr/local/nginx && rm -f /usr/local/sbin/nginx #削除
cd nginx-1.24.0 #ソースが置かれてるディレクトリへ移動
sudo make clean #clean

ビルドし直す程度ならこれで十分なはずですが、設定やら何やら全部消し飛ばしたい場合は

sudo rm -rf /etc/nginx /etc/default/nginx /usr/sbin/nginx* /usr/local/nginx /var/run/nginx.pid /var/log/nginx

を実行してください。

ビルド

sudo ./configure #オプションとかはお好みで
sudo make && sudo make install #makeしましょ
sudo systemctl start nginx #開始

確認

ubuntu@myindigo:~$ 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 Mon 2023-12-04 17:20:41 JST; 2min 5s ago
       Docs: man:nginx(8)
    Process: 101393 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 101405 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 101406 (nginx)
      Tasks: 3 (limit: 9491)
     Memory: 3.6M
     CGroup: /system.slice/nginx.service
             tq101406 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             tq101407 nginx: worker process
             mq101408 nginx: worker process

12月 04 17:20:41 myindigo systemd[1]: Starting A high performance web server and a reverse proxy server...
12月 04 17:20:41 myindigo systemd[1]: Started A high performance web server and a reverse proxy server.

簡単ですね。

3
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
3
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?