Hi there, I'm trying to configure unit for a node.js application. I installed it from the PPA on a fresh Debian 9 VM, and it doesn't seem to respond as expected. Outputs from my various investigations as to why are below.
Any ideas? Something I've missed?
Thanks very much!
[vagrant@unit ~53]$ cat /etc/debian_version
9.9
[vagrant@unit ~54]$ cat /etc/apt/sources.list.d/unit.list
deb https://packages.nginx.org/unit/debian/ stretch unit
deb-src https://packages.nginx.org/unit/debian/ stretch unit
[vagrant@unit ~55]$ dpkg -l | grep unit
ii unit 1.9.0-1~stretch amd64 NGINX Unit
ii unit-dev 1.9.0-1~stretch amd64 NGINX Unit (development files)
[vagrant@unit ~56]$ ps axufww | grep unit
vagrant 12991 0.0 0.1 12780 948 pts/0 S+ 19:41 0:00 \_ grep unit
root 12820 0.0 0.2 29528 1340 ? Ss 19:30 0:00 unit: main v1.9.0 [/usr/sbin/unitd --log /var/log/unit.log --pid /run/unit.pid]
nobody 12822 0.0 0.0 29528 484 ? S 19:30 0:00 \_ unit: controller
nobody 12823 0.0 0.8 29660 4080 ? S 19:30 0:00 \_ unit: router
[vagrant@unit ~57]$ sudo systemctl status unit
● unit.service - NGINX Unit
Loaded: loaded (/lib/systemd/system/unit.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2019-06-14 19:30:33 UTC; 11min ago
Process: 12819 ExecStart=/usr/sbin/unitd $DAEMON_ARGS (code=exited, status=0/SUCCESS)
Main PID: 12820 (unitd)
Tasks: 3 (limit: 4915)
CGroup: /system.slice/unit.service
├─12820 unit: main v1.9.0 [/usr/sbin/unitd --log /var/log/unit.log --pid /run/unit.pid]
├─12822 unit: controller
└─12823 unit: router
Jun 14 19:30:33 unit systemd[1]: Starting NGINX Unit...
Jun 14 19:30:33 unit unitd[12819]: 2019/06/14 19:30:33 [info] 12819#12819 unit started
Jun 14 19:30:33 unit systemd[1]: Started NGINX Unit.
[vagrant@unit ~58]$ curl --unix-socket /var/run/control.unit.sock http://localhost/config/ > config.json
curl: (7) Couldn't connect to server
[vagrant@unit ~59]$ ls -l /var/run/control.unit.sock
srw------- 1 root root 0 Jun 14 19:30 /var/run/control.unit.sock
As you can see, control.unit.sock has permissions only for root user. So in order to access it you have to run the curl command with sudo.
Oh! Oh dear, I should have worked that out. Thank you Valentin, sorry for the noise. 😬
Most helpful comment
As you can see,
control.unit.sockhas permissions only forrootuser. So in order to access it you have to run thecurlcommand withsudo.