This post is mainly a reminder to my future self in case I need to do something like this again.
Using bleeding edge technologies on Windows has always been a painful process. Mainly because not many LAMP developers use windows (its just not in the acronym), which leads to poor support of the OS and lack of learning material.
After playing with NodeJS and watching Ryan’s presentation, I realized all the drawbacks of Apache - my default web server for many years - and decided to give ngninx a shot.
- Download and install a copy of the most recent php version for windows (PHP 5.3.3). Please note, that since we’re not gonna be using Apache, you can download the non tread safe version compiled with VC9.
- The second step is to get nginx executable in the download section of nginx website. On Windows its as simple as unzipping the file into
- After that is done, we need to configure it to work with PHP. To do that let’s open
c:\nginx\conf\nginx.confand create the following server config:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
The above config tells nginx that application on
http://your_app.lcl/ is located at
c:\www\path\to\your\website on your filesystem. Furthermore, it tells nginx that all
*.php files need to be served through a
fast_cgi server on port
* Now that we configured nginx to use
*.php files, we need to start a fast cgi server daemon. From your windows console run
C:\php\php-cgi.exe -b 127.0.0.1:9000, where
C:\php is the php installation path.
* You can access your application at
http://your_app.lcl/ after starting the nginx process in