WordPress.org

Ready to get started?Download WordPress

Forums

WP Smush.it
Wrong Folder (8 posts)

  1. vampired
    Member
    Posted 2 years ago #

    I moved my server to nginx (not sure if this has anything to do with it) but I am unable to use smush it.

    When I go to smush it, it says unable to find file.

    It is looking here:

    /srv/www/example.com/public/wp-content/uploads//var/www/vhosts/example.com/httpdocs/wp-content/uploads/2008/08/8-10-2008-11-52-34-pm.png

    But the path really should be:

    /srv/www/example.com/public/wp-content/uploads/2008/08/8-10-2008-11-52-34-pm.png

    I tried using /wp-content/uploads and wp-content/uploads in the media path to files. I also set the full server path to be http://example.com/wp-content/uploads.

    Nothing seems to work, it always seems to want to add /var/www/vhosts/ to anything I put in there.

    It used to work great, just install the plugin and forget about it. It just worked.

    http://wordpress.org/extend/plugins/wp-smushit/

  2. vampired
    Member
    Posted 1 year ago #

    Any ideas on this?

    It seems like only older posts have this problem, new uploads smush perfectly fine. I have confirmed the media exists and the path is in the same root folder of all the other ones.

  3. Pothi
    Member
    Posted 1 year ago #

    Please post your entire Nginx configuration (without exposing anything important) to check what may have gone with it.

  4. vampired
    Member
    Posted 1 year ago #

    server {
    listen 8080;
    server_name example.com *.example.com;
    root /srv/www/example.com/public;

    access_log /srv/www/example.com/log/access.log;
    error_log /srv/www/example.com/log/error.log;

    include wordpress.conf;
    include browsercache.conf;
    include drop.conf;
    include php.conf;
    }

    wordpress.conf:
    location / {
    index index.php;

    if (-f $request_filename) {
    break;
    }

    set $pgcache "";

    if ($request_method = GET) { set $pgcache "${pgcache}D"; }

    if ($args = "") { set $pgcache "${pgcache}I"; }

    if ($http_cookie !~ (comment_author_|wordpress|wordpress_logged_in|wp-postpass_)) {
    set $pgcache "${pgcache}S";
    }
    if (-f $document_root/wp-content/w3tc/pgcache/$request_uri/_index.html) {
    set $pgcache "${pgcache}K";
    }
    if ($pgcache = "DISK") {
    rewrite ^ /wp-content/w3tc/pgcache/$request_uri/_index.html break;
    }

    if (!-e $request_filename) { rewrite ^ /index.php last; }
    }

    location /search {
    limit_req zone=wpsearch burst=3 nodelay;
    try_files $uri /index.php;
    }

    # Add trailing slash to */wp-admin requests.
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    # Prohibit php files from executing in wp-uploads
    location ~* ^/wp-content/uploads/.*.php$ {
    return 403;
    }

    # enforce www (exclude certain subdomains)
    if ($host !~* ^(www|subdomain))
    {
    rewrite ^/(.*)$ $scheme://www.$host/$1 permanent;
    }

    fastcgi_intercept_errors off;

    browsercache.conf:

    # browser cache
    location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
    expires max;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }

    drop.conf:

    location = /robots.txt { access_log off; log_not_found off; }
    location = /favicon.ico { access_log off; log_not_found off; }
    location ~ /\. { access_log off; log_not_found off; deny all; }
    location ~ ~$ { access_log off; log_not_found off; deny all; }

    php.conf:

    location ~ \.php {
    client_max_body_size 25M;
    try_files $uri =404;
    limit_conn phplimit 5;
    fastcgi_index index.php;

    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;

    fastcgi_param SCRIPT_FILENAME $request_filename;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT $document_root;
    fastcgi_param SERVER_PROTOCOL $server_protocol;

    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;

    fastcgi_param HTTPS $https;

    # PHP only, required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param REDIRECT_STATUS 200;

    fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

  5. Pothi
    Member
    Posted 1 year ago #

    If the error is due to Nginx, there are a couple of ways to troubleshoot...

    1. Try the following line in your php.conf...

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    in place of...

    fastcgi_param SCRIPT_NAME $fastcgi_script_name;

    2. Check, if your php5-fpm environment has any kind of chroot.

    If both didn't fix this issue, it is probably not due to Nginx, php5-fpm stack.

    I hope this helps.

  6. vampired
    Member
    Posted 1 year ago #

    1) Tried it, didn't solve the problem.

    Errror changed from:

    To:

    /srv/www/example.com/public/wp-content/uploads//var/www/vhosts/example.com/httpdocs/wp-content/uploads/2008/08/8-10-2008-11-21-17-pm.png

    /srv/www/example.com/public/wp-content/uploads/varwwwvhostsexample.comhttpdocswp-contentuploads2008088-10-2008-11-49-24-pm.png

    2) No chroot at all.

    The thing is, many of them work fine and smush without problems, the older stuff though throws this error which looks like it is confusing the path by taking the real path and some made one up (perhaps a default) and combining them into one ridiculous path.

  7. Pothi
    Member
    Posted 1 year ago #

    Hello vampired,

    I was just reading my own answer, and I was meant to ask to replace this line...

    fastcgi_param SCRIPT_FILENAME $request_filename;

    Somehow I copied the next line and pasted in my answer.

    If this doesn't help either, I'd recommend switching to CW Image Optimizer that requires additional tools in the server, but works without any issues for me. I tried WP Smush.it after a long time and it does throw a 404 error, but the path to the file was correctly shown by this plugin, in my case.

  8. vampired
    Member
    Posted 1 year ago #

    Thought something looked weird but I tried it anyway.

    I made the new change, still same problem. It is weird, most of the images work fine, the first 91 pages of images out of 100 smush without problems. The last 9 pages give me this odd path issue where it is appending what looks like a default path to the regular path.

    I tried CW Image Optimizer, and for some reason I couldn't get it to work with the tools or something.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic