Ubuntu 在虚拟机中全新安装,存在 nginx 权限问题

Ubuntu 在虚拟机中全新安装,存在 nginx 权限问题

我根据标准映像构建了一个全新的虚拟机Ubuntu 18/04 LTS x64 Server

安装更新,然后VBox Guest Additions按照简单步骤进行安装此处概述

使用以下命令安装 nginx:

sudo apt-get install nginx

我检查该服务是否正在运行;

papa@papa:~$ systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-05-30 18:01:37 UTC; 14s ago
     Docs: man:nginx(8)
  Process: 823 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 783 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 832 (nginx)
    Tasks: 2 (limit: 1112)
   CGroup: /system.slice/nginx.service
           ├─832 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           └─840 nginx: worker process

May 30 18:01:37 papa systemd[1]: Starting A high performance web server and a reverse proxy server...
May 30 18:01:37 papa systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
May 30 18:01:37 papa systemd[1]: Started A high performance web server and a reverse proxy server.

运行时nginx -t我得到:

papa@papa:~$ nginx -t
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2018/05/30 18:02:09 [warn] 1234#1234: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
2018/05/30 18:02:09 [emerg] 1234#1234: open() "/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed

由于这是全新安装,为什么nginx没有写入日志所需的权限?另外,为什么Failed to parse PID?我是不是漏掉了某个步骤?

相关内容