参考:
ubuntu版本:
- Ubuntu 18.04 LTS
执行命令:
# 安装导入 GPG 公钥时所需的几个依赖包(整个安装过程完成后可以随时删除它们):
apt-get -y install --no-install-recommends wget gnupg ca-certificates
# 导入我们的 GPG 密钥:
wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
# 安装 add-apt-repository 命令
# (之后你可以删除这个包以及对应的关联包)
apt-get -y install --no-install-recommends software-properties-common
# 添加我们官方 official APT 仓库:
add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"
# 更新 APT 索引:
apt-get update
默认会被安装到/usr/local/openresty目录下:
启动
启动Nginx
# 查看nginx进程
root@磊神:/usr/local/openresty/nginx/sbin# ps -ef | grep nginx
root 9379 226 0 14:13 tty1 00:00:00 grep --color=auto nginx
# 启动nginx
./nginx -c /usr/local/openresty/nginx/conf/nginx.conf
# 查看nginx进程
root@磊神:/usr/local/openresty/nginx/sbin# ps -ef | grep nginx
root 9416 1 0 14:16 ? 00:00:00 nginx: master process ./nginx -c /usr/local/openresty/
nobody 9417 9416 0 14:16 ? 00:00:00 nginx: worker process
root 9419 226 0 14:17 tty1 00:00:00 grep --color=auto nginx
访问:默认80端口