Nginx,编译后的一些问题(文件/文件夹/进程创建)

Nginx,编译后的一些问题(文件/文件夹/进程创建),nginx,Nginx,我正在尝试使用Visual Studio 2015作为一个项目编译Nginx。我遵循了这个教程:,它运行得非常好(即使它是为VS2010制作的) 我终于能够启动nginx.exe,但Web服务器还不能工作,有几件事: 释放模式 程序退出时会显示以下消息: The thread 0x25ac has exited with code 2 (0x2). The thread 0xe64 has exited with code 2 (0x2). The thread 0x1a60 has exite

我正在尝试使用Visual Studio 2015作为一个项目编译Nginx。我遵循了这个教程:,它运行得非常好(即使它是为VS2010制作的)

我终于能够启动nginx.exe,但Web服务器还不能工作,有几件事:

  • 释放模式
  • 程序退出时会显示以下消息:

    The thread 0x25ac has exited with code 2 (0x2).
    The thread 0xe64 has exited with code 2 (0x2).
    The thread 0x1a60 has exited with code 2 (0x2).
    The program '[13872] nginx.exe' has exited with code 2 (0x2).
    
    The thread 0x18a8 has exited with code 1 (0x1).
    The thread 0x3064 has exited with code 1 (0x1).
    The thread 0x2bbc has exited with code 1 (0x1).
    The program '[6868] Nginx.exe' has exited with code 1 (0x1).
    
    error.log文件包含:

    2018/05/28 15:26:09 [crit] 13872#4024: CreateProcess("my\nginx\path\Nginx\Release\nginx.exe") failed (5: FormatMessage() error:(15100))
    
    2018/05/28 14:14:25 [emerg] 13152#14248: CreateDirectory() "my/nginx/path/Nginx/Debug/temp/client_body_temp" failed (123: FormatMessage() error:(15100))
    
  • 调试模式
  • 程序退出时会显示以下消息:

    The thread 0x25ac has exited with code 2 (0x2).
    The thread 0xe64 has exited with code 2 (0x2).
    The thread 0x1a60 has exited with code 2 (0x2).
    The program '[13872] nginx.exe' has exited with code 2 (0x2).
    
    The thread 0x18a8 has exited with code 1 (0x1).
    The thread 0x3064 has exited with code 1 (0x1).
    The thread 0x2bbc has exited with code 1 (0x1).
    The program '[6868] Nginx.exe' has exited with code 1 (0x1).
    
    error.log文件包含:

    2018/05/28 15:26:09 [crit] 13872#4024: CreateProcess("my\nginx\path\Nginx\Release\nginx.exe") failed (5: FormatMessage() error:(15100))
    
    2018/05/28 14:14:25 [emerg] 13152#14248: CreateDirectory() "my/nginx/path/Nginx/Debug/temp/client_body_temp" failed (123: FormatMessage() error:(15100))
    
    这是my/nginx/path/nginx/Debug/和my/nginx/path/nginx/Release/的树状结构:

    nginx.exe
    conf/
        nginx.conf
        a bunch of other conf files
    html/
        index.html
    logs/
        error.log
        acces.log
        nginx.pid
    temp/
        client_body_temp/
    
    注意:我自己创建了不同的文件和文件夹,程序无法执行

  • nginx.conf
  • 最后,我无法在nginx.conf中修改error.log的路径。当我试着去做的时候,似乎一点效果都没有

    error_log logs/error_bis.log;
    
    不创建错误_bis.log,或者在创建文件时不写入错误_bis.log

    注意:前缀路径是在使用命令参数启动nginx.exe时设置的

    -p my/nginx/path/Nginx/Debug
    

    最后一件事,我有管理员特权。

    我终于解决了我的问题

    CreateDirectory调用CreateDirectoryW而不是CreateDirectoryA,因为定义了UNICODE。给函数的是一个无符号字符*,而不是LPWSTR

    我只需要将“字符集”(在属性->常规->项目默认设置中)从“Unicode”设置为“无集”。现在一切都好了