Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

Are you sure you want nginx on windows? from

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.

share|improve this answer

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.

share|improve this answer

Your Answer


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

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