Basically i am trying to setup nginx with apache but i want nginx to serve static content such as javascript, stylesheets, media files etc but i want php to be passed to apache listening on port 8080.

Using the following i can get nginx to redirect php requests to apache listening on port 8080

location ~ \.php$ {
proxy_pass         http:;

But how can i tell nginx to serve all static data such as .css .js .flv. png .ico .gif .jpg etc.


Are you sure you want nginx on windows? from http://nginx.org/en/docs/windows.html:

Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() connection processing method is currently used, so high performance and scalability should not be expected. Due to this and some other known issues version of nginx for Windows is considered to be a beta version.


Add a new location directive which points to your static files:

location ~* \.(css|js|png|ico|gif|jpg)$ { 
   root path/to/static/folder

As for FLV, you'll want to read the HttpFlvModule article if you want to have seek. Otherwise, just add 'flv' into the extension pattern.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.