使用非 root 用户启动 Edge

1. Edge Admin

安装了 openresty-edge-admin 包之后,先修改目录的权限(假设使用 nobody 用户):

sudo chown nobody -R /usr/local/oredge-admin

给可执行文件增加监听特权端口的权限:

sudo setcap 'cap_net_bind_service=+ep' /usr/local/openresty-plus/nginx/sbin/nginx

使用 systemctl 启动 Edge Admin 服务(假设使用 nobody 用户):

sudo mkdir -p /etc/systemd/system/oredge-admin.service.d/
echo -e '[Service]\nUser = nobody' | sudo tee /etc/systemd/system/oredge-admin.service.d/override.conf

你也许会看到下面这样的警告信息,不过可以忽略:

nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/oredge-admin/conf/nginx.conf

使用下面的命令设置服务开机自启动:

sudo systemctl enable oredge-admin

2. Edge Node

安装了 openresty-edge-node 包之后,先修改目录的权限(假设使用 nobody 用户):

sudo chown nobody -R /usr/local/oredge-node

给可执行文件增加监听特权端口的权限:

sudo setcap 'cap_net_bind_service=+ep' /usr/local/openresty-plus/nginx/sbin/nginx

使用 systemctl 启动 Edge Node 服务(假设使用 nobody 用户):

sudo mkdir -p /etc/systemd/system/oredge-node.service.d/
echo -e '[Service]\nUser = nobody' | sudo tee /etc/systemd/system/oredge-node.service.d/override.conf

你也许会看到下面这样的警告信息,不过可以忽略:

nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/oredge-node/conf/nginx.conf

使用下面的命令设置服务开机自启动:

sudo systemctl enable oredge-node

3. Edge Log Server

安装了 openresty-edge-log-server 包之后,先修改目录的权限(假设使用 nobody 用户):

sudo chown nobody -R /usr/local/oredge-log-server

给可执行文件增加监听特权端口的权限:

sudo setcap 'cap_net_bind_service=+ep' /usr/local/openresty-plus/nginx/sbin/nginx

使用 systemctl 启动 Edge Log Server 服务(假设使用 nobody 用户):

sudo mkdir -p /etc/systemd/system/oredge-log-server.service.d/
echo -e '[Service]\nUser = nobody' | sudo tee /etc/systemd/system/oredge-log-server.service.d/override.conf

你也许会看到下面这样的警告信息,不过可以忽略:

nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/oredge-log-server/conf/nginx.conf

使用下面的命令设置服务开机自启动:

sudo systemctl enable oredge-log-server