树莓派无法启动nginx解决方法

重启树莓派后,无法远程访问WEB页面,SSH连接正常。输入systemctl status nginx,发现错误。
root@raspberrypi:~# systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en
   Active: failed (Result: exit-code) since Sun 2017-10-08 12:22:43 CST; 15s ago
     Docs: man:nginx(8)
  Process: 1613 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process 

Oct 08 12:22:43 raspberrypi systemd[1]: Starting A high performance web server a
Oct 08 12:22:43 raspberrypi nginx[1613]: nginx: [alert] could not open error log



但是一直不知道是哪里出了问题。搜索了网络,输入命令nginx -t -c /etc/nginx/nginx.conf




root@raspberrypi:~# nginx -t -c /etc/nginx/nginx.conf 

nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory) 
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 2017/10/08 12:30:36 [emerg] 1861#1861: open() "/var/log/nginx/access.log" failed (2: No such file or directory) 
nginx: configuration file /etc/nginx/nginx.conf test failed




发现提示/var/log/nginx/error.log及access.log缺失。按提示手动建立这两个文件,即可启动。

评论

此博客中的热门博文

aria2 下载时出现errorcode=19 name resolution failed错误的解决办法

KODI(XMBC)安装中文字幕插件

CENTOS 7搭建Resilio-sync 官方指导步骤