Nginx Drupal Rewrite

Claude Bing tehbing at gmail.com
Sat May 16 20:09:41 MSD 2009


Ok, I followed a tutorial online and was trying to get rewrite working on my
server.  Well, everything works ok except for my Photo gallery which is
located in | <domain>/gallery |.  I'll include my current config for the
domain (wfto.cc and wfto.cc/gallery)
========================
server {
        listen 80;
        server_name www.waterfortheoppressed.com waterfortheoppressed.com;

        rewrite ^ http://wfto.cc permanent;
}

server {
        listen   80;
        server_name www.wfto.cc  wfto.cc;


        access_log  /var/www/logs/wfto.cc.access.log;

        location = / {
                root   /var/www/wfto.cc;
                index  index.php index.html index.htm;
        }
        location / {
            root   /var/www/wfto.cc;
            index  index.php index.html;

            if (!-f $request_filename) {
                rewrite  ^(.*)$  /index.php?q=$1  last;
                break;
            }

            if (!-d $request_filename) {
                rewrite  ^(.*)$  /index.php?q=$1  last;
                break;
            }
        error_page  404  /index.php;

        # serve static files directly
        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
              access_log        off;
            expires           30d;
        }
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root   /var/www/nginx-default;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
                #proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME
/var/www/wfto.cc$fastcgi_script_name;
                include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny  all;
        }
}
}
========================

Claude

-- 

Laurence J. Peter<http://www.brainyquote.com/quotes/authors/l/laurence_j_peter.html>
- "Originality is the fine art of remembering what you hear but
forgetting
where you heard it."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090516/efefa282/attachment.html>


More information about the nginx mailing list