Creating a self-containing Nginx executable.

So I was wondering how MAMP / XAMP made the self-contained executables work so I wanted to create my own self-contained binary of nginx and it turned to be quite easy to create it.

Download the sourcefiles from

Navigate to the downloaded source file and call the configure exec with this params:
$ ./configure --prefix="" --error-log-path=""

Then run:

If everything goes well until here, you are much pretty done. After the make command finishes an ‘objs’ file gets created, there is where our self contained nginx install will be.

Go to the objs file and do this:
1. Copy mime.types (that resides inside the conf folder) to the ‘objs’ folder.
2. Create a ‘logs’ folder inside the ‘objs’ folder.
3. Create an empty ‘error.log’ and ‘access.log’ files inside the ‘logs’ folder created on step 2.
4. Copy your nginx.conf inside the ‘objs’ folder. (you can find a conf file inside the ‘conf’ folder

And you are done!.

To start the engine just type this:

$: ./nginx -c nginx.conf

And to stop it:

$: ./nginx -c nginx.conf -s stop