Help needed with nginx boost/rewrite rules..

Events happening in the community are now at Drupal community events on www.drupal.org.
demon326's picture

Hello all,

For the moment im using nginx as fronted for apache, but I'd like to get rid of the htaccess in drupal so apache doesn't use more resources then needed, but that means that i need to get boost and the rewrite rules in it, and thats the part when i got stuck.

This is the contents of the /etc/nginx/sites-enabled/default file:

###############################################################################
# default
###############################################################################
# Default by nginx guideline
client_header_timeout  3m;
client_body_timeout    3m;
send_timeout           3m;

client_header_buffer_size    1k;
large_client_header_buffers  4 8k;

client_max_body_size       100m;
client_body_buffer_size    128k;

# Hash Table
server_names_hash_bucket_size 64;

# Proxy
proxy_connect_timeout      90;
proxy_send_timeout         90;
proxy_read_timeout         90;

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

server {
    listen   80 default;

    # Dydamic Content forward to Apache
    location / {
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:8080;
    }
}

###############################################################################
# virtualhost
###############################################################################

server {
    server_name www.site.be site.be;
    root /var/www/site.be/web;

    # Static Contents
        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)$ {
        access_log off;
        expires 30d;
    }


location ^~ /files/imagecache/ {
            index  index.php index.html;
                if (!-e $request_filename) {
                    rewrite ^/(.*)$ http://site.be:8080/$1 last;
                    break;
                }
}

# Dydamic Content forward to Apache
    location / {
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:8080;
    }

}

#nginx status
server {
  listen 127.0.0.1;
  server_name localhost;
  location /nginx_status {
    stub_status on;
    access_log off;
    allow 127.0.0.1;
    deny all;
  }
}

So where and how do i put the drupal and boost rewrite rules so that only php requests are going to apache?.

Please note that i can't lose apache since im also using a phpbb board with its own rewrite rules that don't have a nginx variant..

Note: i know that a V host needs its own file, but its the only site on the vps server, so no need for extra files :)

Thanks for your time!

Comments

try_files

magoo's picture

you should avoid ifs if you can. Use try_files if the nginx version supports it.

For your request I suggest you read http://drupal.org/node/244072 as it is marked as fixed.

It is a long thread but interesting read.

Why don't try varnish? Its

killua99's picture

Why don't try varnish? Its like boost but more powerfull and its clear and don't need to figureout the .htaccess for nginx and apache.

[at]killua99 ~~

Why Varnish?

perusio's picture

It's one more piece in the mechanism. It's not faster than microcaching and it's more resource heavy.

Nginx

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: