bh6635 2016-10-17 09:22 采纳率: 0%
浏览 36887

nginx 错误提示 "The system cannot find the path specified"

将nginx.exe文件拖入命令行窗口,回车运行后,出现以下错误提示:
nginx:
[alert] could not open error log file: CreateFile() "logs/error.log" failed
(3: The system cannot find the path specified)
2016/10/17 15:52:21
[emerg] 7204#2148: CreateFile() "C:\Windows\system32/conf/nginx.conf" failed
(3: The system cannot find the path specified)
网上搜索了一下相关资料,在梦中梦的博文“windwos nginx 不在exe目录运行的错误”中找到了一丝线索,博文地址如下:
http://meiyitianabc.blog.163.com/blog/static/1050221272013615253563
文中写道,出现这个错误提示的原因是我们把nginx的目录加入到系统环境变量的path中去了,然而nginx启动时各种路径都是以当前工作目录为起点的,这就导致了系统去"C\Windows\system32/conf/nginx.conf"这个地方去寻找配置文件,而不是正常的"nginx安装路径/conf/nginx.conf"。
我这才想起来,之前为了能够在命令行窗口下输入nginx回车启动nginx,我把nginx安装路径加入了系统环境变量的path中去了。当下我就打开系统环境变量,把nginx安装路径移除了。心想这下应该大功告成了吧……
不错……如你所料,我又遇到了新的问题——计算机的错误总是层出不穷。当我再次尝试之前的操作,系统给出了以下错误提示:
nginx:
[alert] could not open error log file: CreateFile() "logs/error.log" failed
(3: The system cannot find the path specified)
2016/10/17 16:11:05
[emerg] 7536#5292: CreateFile() "C:\Users\T/conf/nginx.conf" failed
(3: The system cannot find the path specified)
乍一看,还以为是同一个错误。仔细看了下,上个错误提示中的:
[emerg] 7204#2148: CreateFile() "C:\Windows\system32/conf/nginx.conf" failed
(3: The system cannot find the path specified)
路径改变了,变成了:
[emerg] 7536#5292: CreateFile() "C:\Users\T/conf/nginx.conf" failed
(3: The system cannot find the path specified)
有了前面的经验,我自然地打开环境变量去检查用户环境变量(前面是系统环境变量),结果,在用户环境变量的path中并没有找到nginx的安装路径,一时之间我有些不知所措了。

----------------------------- 分割线 -----------------------------

写了个简单的启动nginx.exe的bat脚本,结果呢,这个脚本放在nginx安装路径下运行可以成功地启动nginx,放在其它目录就失效了,这……顿时我就凌乱了。
好吧,不玩了,老老实实地进nginx安装目录启动它吧。

  • 写回答

1条回答 默认 最新

  • oyljerry 2016-10-17 09:31
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件