Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: How to setup Nginx as a Service?

$
0
0
I guess my original post didn't make it clear, but I was coding a C++ service wrapper using the example give by msdn. Anyway I got it working. however, I assume that just using that srvany is probably coded better than mine, so I just used that instead.

Thanks for the help.

On a side note, the reason that I couldn't get my service to work originally was because my bat file would call nginx.exe without moving to the folder where the nginx.exe was stored. Then nginx would use the calling folder rather than the folder with the exe to determine the path to files nginx needed.

For example,

when my bat file contained "c:\nginx\nginx.exe" and I ran the bat file from within the folder where nginx was stored, it ran fine.

However, if I were for example in c:\system32 and called c:\nginx\nginx.exe it would fail because nginx would attempt to find files inside c:\system32\logs when it really wanted to be pointing to c:\nginx\logs.

Basically in my C++ code when i made a new process that called "cmd /c BatchFile.bat," the new cmd window would start in the folder system32. So when i changed my bat file so that I moved to the nginx folder before calling nginx, it ran fine.

I still think it's a little strange that nginx used the calling folder to determine its path though. Was that intended?

Viewing all articles
Browse latest Browse all 4759

Trending Articles