要用普通用户启动已通过rpm包安装的OpenResty,可以按照以下步骤进行操作:

  1. 确保已经安装了OpenResty rpm包。如果没有安装,请先通过以下命令安装:

    sudo yum install openresty
    
  2. 找到OpenResty的安装路径。通常情况下,OpenResty的安装路径为/usr/local/openresty。

  3. 创建一个普通用户,并设置密码。可以使用以下命令创建一个名为openresty的用户:

    sudo useradd -m -s /bin/bash openresty
    sudo passwd openresty
    
  4. 将OpenResty的安装路径设置为openresty用户的所有者。可以使用以下命令进行设置:

    sudo chown -R openresty:openresty /usr/local/openresty
    
  5. 切换到openresty用户。可以使用以下命令切换到openresty用户:

    su - openresty
    
  6. 在openresty用户下,使用以下命令启动OpenResty:

    /usr/local/openresty/nginx/sbin/nginx
    

    如果一切正常,OpenResty将会以普通用户openresty的身份启动。

注意:如果OpenResty配置文件中使用了低于1024的端口号(如80),则需要使用sudo命令以root用户身份运行OpenResty

rpm 包安装的openresty 怎么用普通用户启动

原文地址: http://www.cveoy.top/t/topic/iS6V 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录