Ubuntu安装配置OpenResty教程及补充方案

Ubuntu安装OpenResty教程

# import our GPG key:
wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
# for installing the add-apt-repository command
# (you can remove this package and its dependencies later):
sudo apt-get -y install software-properties-common
# add the our official APT repository:
sudo add-apt-repository -y "deb http://openresty.org/package/debian $(lsb_release -sc) openresty"
# to update the APT index:
sudo apt-get update
sudo apt-get install openresty

执行完上面一串就安装完最新版的OpenResty了。

Ubuntu配置OpenResty教程

奶牛先说下配置文件的位置:

OpenResty启动文件:/etc/rc0.d/K01openresty
OpenResty启动文件:/etc/init.d/openresty  (ldconf openresty default会生成不同runlevel的conf,Ubuntu的默认runlevel是5)
OpenResty的Nginx配置文件:/usr/local/openresty/nginx/conf/nginx.conf
OpenResty的默认目录:/usr/local/openresty/nginx/html/

然后剩下的就可以自己安装Nginx进行配置了。

OpenResty安装补充方案 设置www用户和组

groupadd www 
useradd -g www -s /sbin/nologin www

设置/usr/local/openresty/nginx/conf/nginx.conf,添加

user  www www;
worker_processes  auto;
奶牛 | 2019年08月27日