LoginSignup
3
1

More than 1 year has passed since last update.

nginx の設定を初期化する方法

Posted at

はじめに

nginx の設定ファイルをいろいろいじっていて、訳がわからなくなった際に初期化したかったが手間取ったので備忘録として残す。OS は Ubuntu-20.04 を使用している。

nginx のアンインストール

apt ではパッケージを削除する際に remove と purge があり、remove は設定ファイルは残り、purge では設定ファイルごと削除する。apt remove 後に再度インストールしても、以前の設定ファイルが残っているため設定の初期化はできない。
さらに sudo apt purge nginx とするだけでは設定ファイルは消えず、以下コマンドのように nginx 関連の他のパッケージもまとめて削除することで完全にアンインストールすることができる。

$ sudo apt purge nginx nginx-common nginx-full

上記実行後に、再度 $ sudo apt install nginx とすれば設定を初期化した状態で nginx をインストールし直せる。

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