I have an nginx service and it works perfectly, the only problem is I can't enable it. I followed this thread Not a native service systemd - can't run on boot and did what was told in the accepted answer and I still have a problem.
When I run:
sudo systemctl enable nginx.service
I get:
Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx
update-rc.d: error: nginx Default-Start contains no runlevels, aborting.
When I start it with sudo systemctl start nginx.service
and run:
sudo systemctl status nginx.service
I am getting:
nginx.service - The NGINX HTTP and reverse proxy server
Loaded: loaded (/etc/systemd/system/nginx.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2020-10-28 08:26:05 UTC; 57min ago
Tasks: 3 (limit: 2303)
CGroup: /system.slice/nginx.service
├─1281 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
├─2094 nginx: worker process
└─2095 nginx: cache manager process
Oct 28 08:26:04 vps-cef86568 systemd[1]: Starting nginx.service...
Oct 28 08:26:05 vps-cef86568 nginx[1262]: * Starting Nginx Server
Oct 28 08:26:05 vps-cef86568 nginx[1262]: ...done.
Oct 28 08:26:05 vps-cef86568 systemd[1]: Started nginx.service.
My /etc/systemd/system/nginx.service
file looks like this:
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Any suggestions how to enable it?
Oct 28 10:32:07 vps-server-45123945 systemd[1]: Reloading.