しらいしの雑記集

nginxを入れたのに起動できなかった話

どうも白石(Siraisi_1108)です。ついこの前、Nginxを用いたリバースプロキシの構成をしようと思い、

$ dnf install nginx
$ systemctl start nginx

を実行したところ、インストール直後なのにnginxが起動しないという現象が発生しました。

下のコマンドで調べてみると

$ lsof -i | grep nginx
nginx     38455            root    9u  IPv4 231576      0t0  TCP *:http (LISTEN)
nginx     38455            root   10u  IPv6 231577      0t0  TCP *:http (LISTEN)
nginx     38456           nginx    9u  IPv4 231576      0t0  TCP *:http (LISTEN)
nginx     38456           nginx   10u  IPv6 231577      0t0  TCP *:http (LISTEN)
nginx     38457           nginx    9u  IPv4 231576      0t0  TCP *:http (LISTEN)
nginx     38457           nginx   10u  IPv6 231577      0t0  TCP *:http (LISTEN)
nginx     38458           nginx    9u  IPv4 231576      0t0  TCP *:http (LISTEN)
nginx     38458           nginx   10u  IPv6 231577      0t0  TCP *:http (LISTEN)
nginx     38459           nginx    9u  IPv4 231576      0t0  TCP *:http (LISTEN)
nginx     38459           nginx   10u  IPv6 231577      0t0  TCP *:http (LISTEN)
nginx     38460           nginx    9u  IPv4 231576      0t0  TCP *:http (LISTEN)
nginx     38460           nginx   10u  IPv6 231577      0t0  TCP *:http (LISTEN)
nginx     38461           nginx    9u  IPv4 231576      0t0  TCP *:http (LISTEN)
nginx     38461           nginx   10u  IPv6 231577      0t0  TCP *:http (LISTEN)

起動した覚えがないのに立ち上がっているnginxのプロセスがかなり出てきました。なのですべてkillコマンドで終了

$ sudo kill -9 38455 38456 38457 38458 38459 38460 38461

そしてnginxを再起動してステータスを確認してみると

● nginx.service - The nginx HTTP and reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
     Active: active (running) since Sat 2021-10-09 15:33:45 JST; 6s ago

しっかりとActive表示(起動)を確認できました。
インストール直後なんだからちゃんと起動してくださいよ、、、