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

I have a working configuration in nginx which is like this

server {
    listen 80;

    location / {
        proxy_redirect default;

        proxy_set_header    Host        $host;
        proxy_set_header    X-Real-IP   $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;

        client_max_body_size       100m;
        client_body_buffer_size    128k;

        proxy_connect_timeout      600;
        proxy_send_timeout         600;
        proxy_read_timeout         600;

        proxy_buffer_size          4k;
        proxy_buffers              4 32k;
        proxy_busy_buffers_size    64k;
        proxy_temp_file_write_size 64k;

    location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|htm|html)$ {


How can I emulate this with apache ? I tried the below configuration but the static content do not serve.

<VirtualHost *:80>
<Location />
    ProxyPass !

How can I get static content to serve in the same way as nginx does? Or is it even possible ? Thanks in advance

share|improve this question

The order of ProxyPass directives matters, and unlike nginx, all location blocks that are match are applied, from least specific to most specific.

In other words, you'll need to change your approach a bit for it to work.

Probably the more straightforward and readable approach would be to use mod_rewrite:

RewriteRule \.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|htm|html)$ - [L]
RewriteRule ^/(.*)$$1 [P,L]
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.