无法启动nginx.service:找不到单元

无法启动nginx.service:找不到单元,nginx,systemctl,Nginx,Systemctl,我安装了最新版本的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 一切

我安装了最新版本的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 not found”:

我不知道为什么或者问题出在哪里。运行“nginx-V”显示已设置目录

有人有线索吗?
提前感谢

试试下面的方法,让我们看看会发生什么

sudo yum安装epel版本
sudo yum安装nginx
sudo systemctl-l启用nginx
sudo systemctl-l启动nginx

它最初对我不起作用,因为没有安装epel版本。但这是假设您使用的是Fedora/CentOs

非常感谢Chetan,看来“systemctl守护程序重新加载”解决了这个问题。一开始我觉得对方的问题太不一样了。谢谢