web-dev-qa-db-ja.com

nginx.serviceの起動に失敗しました:Unitが見つかりません

私は最新バージョンのNginxをインストールし、いくつかのディレクトリを設定しました。

./configure --sbin-path=/usr/bin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-pcre --pid-path=/var/run/nginx.pid --with-http_ssl_module
 _

それはすべて完全にうまく機能します。その後カスタムファイルを作成しました。

nano /lib/systemd/system/nginx.service
 _

ファイルの内容

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/bin/nginx -t
ExecStart=/usr/bin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
 _

しかし、 "systemctl start nginx"を実行すると "Unitが見つかりません"というエラーが表示されます。

enter image description here

なぜまたは問題は何ですか。 "nginx -v"を実行すると、ディレクトリが設定されています。

誰かが手がかりを持っていますか?前もって感謝します

3
sir-haver

次のことを試してみて、何が起こるのか見てみましょう。

 Sudo yum install epel-release
 Sudo yum install nginx
 Sudo systemctl -l enable nginx
 Sudo systemctl -l start nginx
 _

Epel-Releaseがインストールされていないため、最初は最初はうまくいきませんでした。しかし、これはあなたがFedora/Centosを使っていると仮定しています

1
anabeto93