Nginx Drupal Rewrite

Michael Shadle mike503 at gmail.com
Sat May 16 20:15:20 MSD 2009


We've got drupal going with a simple try_files $uri $uri/ /path/to/ 
drupal/index.php?q=$uri&$args;

In nginx 0.7 of course.

On May 16, 2009, at 9:09 AM, Claude Bing <tehbing at gmail.com> wrote:

> 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  - "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/3c81802f/attachment.html>


More information about the nginx mailing list