Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hey all, I've read up on the wonders of nginx the last few days and recently downloaded it....they only question I have is how exactly do you run files on it? I went to localhost in my browser, and saw that it was running, but it's not very clear how to run scripts (php, python, etc) on it. I've read a little about FastCGI, but nothing conclusive.This is from the guy very familiar with Apache and used to how the whole /htdocs shindig works. This is the Windows nginx server package. I've got PHP5 and Python2.6 on my box

share|improve this question

2 Answers 2

nginx is not the easiest web-server to configure out there. That said, you should check their documentation for configuration examples. They already have a number of examples on their wiki for various cgi apps, including PHP and Python.

share|improve this answer
    
Yeah, I did that already, but I think that I didn't look hard enough. Thanks, I look into it more tomorrow. –  genieyclo Oct 5 '09 at 1:59

What's probably going to be confusing you is the fact that nginx does not run CGI scripts. It's a conscious design decision, as it makes the rest of the asynchronous connection management code a lot easier, and when all's said and done, spawning customer-written dynamic code with the privileges of the webserver is an intensely unpleasant idea.

There is a CGI to FCGI wrapper in the nginx wiki, where you run the wrapper and it'll listen for FCGI connections and run the CGI program you specify. PHP has an FCGI mode built-in, and most Python interfaces have some way to coax an FCGI listener out (and nginx has ways to connect some of them natively). It's still not real pleasant, though, and it's made a million times harder on Windows because it's got such half-arsed daemon management. A linux box with daemontools, on the other hand, is actually relatively straightforward to get (and keep) going.

share|improve this answer
    
lighttpd has spawn-fcgi. Maybe that's what you're thinking of? –  sybreon Oct 6 '09 at 0:33
    
No, spawn-fcgi is a whole other (and, as far as I can tell, largely useless) kettle of fish. I got curious, though, and went and found what I was referring to. Answer updated. –  womble Oct 6 '09 at 1:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.