Skip to:
Content
Pages
Categories
Search
Top
Bottom

Avatars Nginx 0.7 + WPMU 2.9.2 + BP 1.2 Rewrite Issue?

  • @stormin303

    Participant

    Been having a look at why I can’t get avatars to crop and display properly in BP under Nginx. They upload fine in the proper directories, just don’t display properly.

    Image links are missing the /wp-content/ part and appear like http://mysite.com/blogs.dir/1/files/avatars/1/dpavatar150.png.

    So been playing around with my server over the last few weeks and it definately seems like an Nginx rewrite issue on my original config.

    To prove the point, on the same server/WPMU setup I’ve installed Apache2 and can flip between a number of setups. All works fine on Apache, even works fine running on Apache anf using Nginx as a proxy using the WP Nginx Integrator plugin. I can upload, crop and see avatars all I want.

    As soon as I flip back to Nginx standalone setup I get the avatar issues back. I could settle for the Apache / Nginx setup but Nginx & FastCGI seems to have the leading edge on things from what I’ve been playing with so far.

    So my Nginx config is below and would be greatful if someone could point me in the right direction.

    user www-data;

    worker_processes 2;

    error_log /var/log/nginx/error.log;

    pid /var/run/nginx.pid;

    events {

    worker_connections 1024;

    }

    http {

    server_tokens off;

    include /etc/nginx/mime.types;

    default_type application/octet-stream;

    access_log /var/log/nginx/access.log;

    client_body_temp_path /var/lib/nginx/body 1 2;

    server_names_hash_bucket_size 64;

    gzip_buffers 32 8k;

    sendfile on;

    #tcp_nopush on;

    keepalive_timeout 65;

    tcp_nodelay on;

    gzip on;

    gzip_comp_level 5;

    gzip_http_version 1.0;

    gzip_min_length 0;

    gzip_types application/javascript text/javascript text/css text/xml application/atom+xml application/xml;

    gzip_vary on;

    include /etc/nginx/conf.d/*.conf;

    include /etc/nginx/sites-enabled/*;

    }

    server {

    listen 80;

    server_name mysite.com *.mysite.com;

    access_log /var/www/mysite.com/log/dinkynz.access.log;

    error_log /var/www/mysite.com/log/dinkynz.error.log;

    location / {

    root /var/www/mysite.com/public;

    index index.php;

    error_page 404 = /index.php?q=$uri;

    gzip on;

    gzip_http_version 1.0;

    gzip_vary on;

    gzip_comp_level 3;

    gzip_proxied any;

    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    gzip_buffers 16 8k;

    #rewrite for sitemaps

    rewrite ^(.*/)?sitemap.xml /wp-content/sitemap.php last;

    rewrite ^/files(/.*)$ /wp-content/blogs.php?file=$1 last;

    if (!-e $request_filename) {

    rewrite ^.+/?(/wp-.*) $1 last;

    rewrite ^.+/?(/.*\.php)$ $1 last;

    rewrite ^(.+)$ /index.php?q=$1 last;

    }

    #


    Error handling


    #

    #error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html

    #

    error_page 500 502 503 504 /50x.html;

    location = /50x.html {

    root /var/www/mysite.com/public;

    }

    #


    Error handling


    #

    }

    #


    php config


    #

    location ~ \.php$ {

    # rewrite ^/.*(/wp-.*/.*.php)$ $1;

    fastcgi_pass 127.0.0.1:9000;

    fastcgi_index index.php;

    fastcgi_param SCRIPT_FILENAME /var/www/mysite.com/public/$fastcgi_script_name;

    fastcgi_param SCRIPT_FILENAME /var/www/mysite.com/public/$fastcgi_script_name;

    include fastcgi_params;

    }

    #


    php config


    #

    #


    WPMU rewrites


    #

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

    {

    root /var/www/mysite.com/public;

    rewrite ^/files(/.*)$ /wp-content/blogs.php?file=$1 last;

    expires 10d;

    break;

    }

    #


    WPMU rewrites


    #

    #


    phpmyadmin


    #

    location /phpmyadmin {

    root /var/www/mysite.com/public;

    index index.php;

    }

    location ~ ^/phpmyadmin.+\.php$ {

    root /var/www/mysite.com/public;

    fastcgi_index index.php;

    fastcgi_pass 127.0.0.1:9000;

    fastcgi_param SCRIPT_FILENAME /var/www/mysite.com/public/$fastcgi_script_name;

    include fastcgi_params;

    # fastcgi_param HTTPS on;

    }

    location /phpMyAdmin {

    rewrite ^/* /phpmyadmin last;

    }

    #


    phpmyadmin


    #

    }

    Much appreciated :)

Viewing 2 replies - 1 through 2 (of 2 total)
  • @stormin303

    Participant

    If anyone is interested, finally got it working…

    Changed the WPMU rewrites to

    #


    WPMU rewrites


    #

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

    {

    root /var/www/mysite.com/public;

    rewrite ^/.*(/wp-.*/.*.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;

    rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ /wp-content/blogs.php?file=$1 last;

    expires 30d;

    break;

    }

    #


    WPMU rewrites


    #

    goodbye apache :)

    @stormin303

    Participant

    Whilst the user avatar uploads worked I discovered the Group Avatars didn’t and I was getting 404’s.

    However I managed to get around this by chaninging the WPMU Rewrites in Nginx to the code below.

    Similar issues with BP Album+ not showing images. I got it working by hacking the code before but since I’m on a run with Nginx at the mo I’ll have a look at the rewrite for that and BP Calendar.

    #


    WPMU rewrites


    #

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

    {

    root /var/www/dinkypages.co.nz/public;

    rewrite ^/.*(/wp-.*/.*.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;

    rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ /wp-content/blogs.php?file=$1 last;

    rewrite ^.*/files/(.*) /wp-content/blogs.php?file=$1;

    if (!-e $request_filename) {

    rewrite ^.+/?(/wp-.*) $1 last;

    rewrite ^.+/?(/.*\.php)$ $1 last;

    rewrite ^(.+)$ /index.php?q=$1 last;

    }

    expires 30d;

    break;

    }

    #


    WPMU rewrites


    #

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Avatars Nginx 0.7 + WPMU 2.9.2 + BP 1.2 Rewrite Issue?’ is closed to new replies.
Skip to toolbar