WordPress MU rewrite rules
Daniele Melosi
ml at melosi.it
Tue Oct 20 18:03:43 MSD 2009
I've similar error with wordpress mu configured on nginx + fastcgi
if I enabled permalink in this format: /%year%/%monthnum%/%day%/%postname%/
(es. http://test.mydomain.tld/2009/10/20/test02/) i received every time
the same page, if i configured permalinks in the default format every
think works fine (for example: http://test.mydomain.tld/?p=123))
This is my configuration:
server {
listen 80;
server_name test.mydomain.tld;
access_log /var/log/nginx/test.mydomain.tld.log;
error_log /var/log/nginx/test.mydomain.tld.error.log;
error_log /var/log/nginx/test.mydomain.tld.error.log notice;
rewrite_log on;
location / {
root /var/www/test.mydomain.tld;
index index.php index.html index.htm;
if (-f $request_filename) {
expires 30d;
break;
}
rewrite ^.*/files/(.*) /wp-content/blogs.php?file=$1;
if (!-e $request_filename) {
rewrite ^ /index.php last;
}
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass fcgi5;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/var/www/test.mydomain.tld$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT
/var/www/test.mydomain.tld/;
}
}
This is the rewrite logs:
2009/10/20 11:57:45 [notice] 3183#0: *17 "^.*/files/(.*)" does not match
"/2009/10/20/test01/", client: 192.168.251.27, server:
drupal.lantians.net, request: "GET /2009/10/20/test01/ HTTP/1.1", host:
"drupal.lantians.net", referrer: "http://drupal.lantians.net/"
2009/10/20 11:57:45 [notice] 3183#0: *17 "^" matches
"/2009/10/20/test01/", client: 192.168.251.27, server:
drupal.lantians.net, request: "GET /2009/10/20/test01/ HTTP/1.1", host:
"drupal.lantians.net", referrer: "http://drupal.lantians.net/"
2009/10/20 11:57:45 [notice] 3183#0: *17 rewritten data: "/index.php",
args: "", client: 192.168.251.27, server: drupal.lantians.net, request:
"GET /2009/10/20/test01/ HTTP/1.1", host: "drupal.lantians.net",
referrer: "http://drupal.lantians.net/"
Any ideas ?
Daniele
Edho P Arief ha scritto:
> On Fri, Oct 9, 2009 at 2:14 PM, pepejose <nginx-forum at nginx.us> wrote:
>> sorry but I do not understand your solution.
>>
>>
>> many thanks to the two
>>
>> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,8334,12295#msg-12295
>>
>>
>>
>
> here's the config I tried and seems to be working:
> http://pastebin.com/m40212ee1
>
> replace
>
> include php_params;
>
> with
>
> proxy_set_header Host $host;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_pass http://127.0.0.1:8080;
>
> like this http://pastebin.com/m1ea4181e
>
> but I'm not sure if it works with apache backend...
>
More information about the nginx
mailing list