安装 OpenResty:找不到 nginx.pid

我尝试在 CentOS 7 上安装 OpenResty 1.13.6.1。当我尝试运行 openresty 时,我会得到以下错误:

[root@flo ~]# openresty -s reload

nginx: [error] open() "/usr/local/openresty/nginx/logs/nginx.pid" 失败 (2: 没有那个文件或目录)

当我查看我的日志时,我只有两个文件:

[root@flo ~]# ll /usr/local/openresty/nginx/logs/

total 8

-rw-r--r--. 1 root root 0 1 mars 12:24 access.log

-rw-r--r--. 1 root root 4875 1 mars 16:03 error.log

我不知道该如何找到解决方案。

///////////////////更新//////////////////

我尝试这样做,遵循这个页面的指示:https://openresty.org/en/getting-started.html

[root@flo ~]# PATH=/usr/local/openresty/nginx/sbin:$PATH

[root@flo ~]# export PATH

[root@flo ~]# nginx -p pwd/ -c conf/nginx.conf

然后我得到以下错误:

nginx: [alert] 无法打开错误日志文件:open() "/root/logs/error.log" 失败 (2: 没有那个文件或目录)

2018/03/02 09:02:55 [emerg] 30824#0: open() "/root/conf/nginx.conf" 失败 (2: 没有那个文件或目录)

/////////////////更新2//////////////:

[root@nexus-chat1 ~]# cd /root/
[root@nexus-chat1 ~]# ll
total 4
-rw-------. 1 root root 1512  1 mars 11:05 anaconda-ks.cfg
drwxr-xr-x. 3 root root 65  1 mars 11:36 openresty_compilation

我需要在哪里创建这些文件夹?

mkdir ~/work
cd ~/work
mkdir logs/ conf/

/usr/local/openresty/ 下吗?

点赞
用户3240686
用户3240686

openresty -s reload 用于告诉 nginx 重新加载当前正在运行的实例。这就是为什么它抱怨缺少 pid 文件的原因。

不管怎样,那不是启动 openresty 的正确方法。请查看 https://openresty.org/en/getting-started.html 获取有关如何入门的指示。

2018-03-02 03:12:30
用户2060502
用户2060502

非常有可能是因为文件夹不存在或权限问题,导致nginx无法打开日志文件。

您可以在error.log文件中查看原因。

2018-03-02 08:17:04