views:

61

answers:

2

Hi everyone, I've been looking for a webserver for my project but I haven't been able to satisfy myself. I need a http server that has support for compiled CGI scripts (exe), for Windows, and must be able to use relative paths. It would be a bonus if the server could be a minimal/lightweight as possible.

The hardest part in my search thus far is finding a server that supports both CGI and has relative path support. When I say relative path, I mean the server root directory. I want to be able to pack this along with my project and therefore the paths in the conf files cannot be absolute.

The only one I've gotten to satisfy every criteria is Abyss Web but their license is proprietary and only free for personal use.

EDIT: I have found the error in my ways. I started the process via cmd at root. Thus the relative paths apache was using in the conf was relative to where I was, at root. By changing to the root dir and running the process there, everything works as gbjbaanb has mentioned. But I suppose the context of my question is may still be valid. If I were to run the server as a process in a my program (C# .NET), what would be the 'current directory' then? Would I have to make sure I've changed the current directory environment variable prior to launching it?

+4  A: 

What's wrong with Apache? You can set DocumentRoot to any directory (though I've not tried it for Windows on C:)

It also does apply to the webserver root directory - don't begin the directive with a / and it works.

gbjbaanb
A: 

I've quickly booted up a mock version of the server that I'm supposed to use and it seems what gbjbaanb is valid for Windows as well. As with *nix, the relative paths work based on what the current directory is when apache is launched. So for Windows, just make sure to set the environment variable for the current directory to the one you want apache to be relative of. For .NET, you just set System.IO.Directory.SetCurrentDirectory() or System.Environment.CurrentDirectory appropriately. I suppose for *nix, you would either cd into the directory before running or use chroot.

ipwnponies