[英]Nginx custom config file setting doesn't work when firing up the server
I am trying to configure the Nginx, PHP on Windows 7 64Bit, such that both PHP & Nginx should always use the path that I have specified to them during startup or in the config files. 我正在尝试在Windows 7 64Bit上配置Nginx,PHP,以便PHP和Nginx都应始终使用启动时或在配置文件中为其指定的路径。
Now as for Nginx, I am starting it's server executable with the following VBScript for custom config file loading: 现在,对于Nginx,我将使用以下VBScript启动它的服务器可执行文件,以用于自定义配置文件加载:
... Vbs code ...
sh.run "cmd /K CD "& NginxPath &" & start nginx", 0
sh.run "cmd /K CD "& NginxPath &" & start nginx -c "& NginxConf, 0
sh.run "cmd /K CD "& NginxPath &" & start nginx -s reload", 0
... Vbs code ...
But it always throws the same error consistently: 但是它始终会始终抛出相同的错误:
2019/01/21 06:53:52 [emerg] 6988#5196: CreateFile() "Custom\Path\mime.types" failed (2: The system cannot find the file specified) in Custom\Path\nginx.conf:18
And even with this error the Server starts but loads the default config file, which shouldn't happen at all. 即使出现此错误,服务器也会启动,但会加载默认配置文件,这根本不会发生。
BTW, the variables NginxPath & NginxConf both have correct Windows Path with proper double-quoting(eg. "C:\\path\\file.conf") 顺便说一句,变量NginxPath和NginxConf都具有正确的Windows路径,并带有正确的双引号(例如“ C:\\ path \\ file.conf”)
Even if we forget about VBscript, and simply fire below command in CMD, it gives same error: 即使我们忘记了VBscript,而只是在CMD中的命令下面触发,它也会产生相同的错误:
nginx -c C:\custom\path\nginx.conf
Error 错误
nginx: [emerg] CreateFile() "C:\custom\path\mime.types" failed (2: The system cannot find the file specified) in C:\custom\path\nginx.conf:18
So why is this happening and how to resolve it with using custom conf file as I desire ? 那么为什么会发生这种情况,以及如何根据需要使用自定义conf文件解决该问题?
I think somewhere in your custom nginx config file exists following line: 我认为您的自定义nginx配置文件中的某处存在以下行:
include mime.types;
Try to add full path to this file (which is located in the same folder where default config file is) to this include
directive: 尝试将此文件(位于默认配置文件所在的文件夹中)的完整路径添加到此include
伪指令:
include C:/path/to/default/config/mime.types;
As alternative, you can place a copy of mime.types
file to the same folder where your custom config file is located. 或者,您可以将mime.types
文件的副本放置到自定义配置文件所在的文件夹中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.