簡體   English   中英

啟動服務器時Nginx自定義配置文件設置不起作用

[英]Nginx custom config file setting doesn't work when firing up the server

我正在嘗試在Windows 7 64Bit上配置Nginx,PHP,以便PHP和Nginx都應始終使用啟動時或在配置文件中為其指定的路徑。

現在,對於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 ...

但是它始終會始終拋出相同的錯誤:

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

即使出現此錯誤,服務器也會啟動,但會加載默認配置文件,這根本不會發生。

順便說一句,變量NginxPath和NginxConf都具有正確的Windows路徑,並帶有正確的雙引號(例如“ C:\\ path \\ file.conf”)

即使我們忘記了VBscript,而只是在CMD中的命令下面觸發,它也會產生相同的錯誤:

nginx -c C:\custom\path\nginx.conf

錯誤

nginx: [emerg] CreateFile() "C:\custom\path\mime.types" failed (2: The system cannot find the file specified) in C:\custom\path\nginx.conf:18

那么為什么會發生這種情況,以及如何根據需要使用自定義conf文件解決該問題?

我認為您的自定義nginx配置文件中的某處存在以下行:

include       mime.types;

嘗試將此文件(位於默認配置文件所在的文件夾中)的完整路徑添加到此include偽指令:

include       C:/path/to/default/config/mime.types;

或者,您可以將mime.types文件的副本放置到自定義配置文件所在的文件夾中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM