Topic on Project:Support desk

[RESOLVED] MW 1.23.3 - "404 Not Found" then I try open uploaded images or generate thumbnails

13
Watchdream (talkcontribs)

Recently I installed Wiki on hosting.

MW 1.23.3

PHP 5.4.4-14 + deb7u12 (apache2handler)

MySQL 5.5.38-0 + wheezy1-log

When downloading images I discovered the problem – thumbnails do not generate and I can’t open images. When you try to open Wiki shows error "404 Not Found". I suspect that I have a problem with access to the temp folder for uploaded images, as I had a similar problem on older versions of MW. How I can fix this problem and what a bug is it?

Florianschmidtwelzow (talkcontribs)

Hello!

Please describe your problem with more details. What you want to do and what doesn't work (the thumbnail isn't visible, or the image on the image page?). Is there any error message when you upload an image or when you access the file page? If yes, what error message?

Watchdream (talkcontribs)

Thanks for quick reaction.

So,

http://echoespro.creativereactor.ru/index.php/Special:ListFiles

The uploaded images can be opened directly, then they are visible in original image resolution, but when I try to open image as File: image_name.png , then I see on blank screen "404 Not Found". You can see it - http://echoespro.creativereactor.ru/index.php/File:CombineLogo.png

Thumbnail generation work on Wiki pages (at least until now work), but doesn't work on Image\File page. Perhaps the problem is not in the thumbnail generation, but maybe in access to the file page, as you suggested.

I hope I explained clearly. If TL; DR, then try to look at the problem itself on my links.

Ciencia Al Poder (talkcontribs)

Apparently it's a misconfiguration of your webserver.

This URL works: http://echoespro.creativereactor.ru/index.php?title=File:CombineLogo.png

Every URL where you use short URL syntax (index.php/pagename) ends in a 404 error if it ends with a known file extension (.png, .jpg, .txt... but not .mng for example).

It may be some rewrite rule on the server, or something similar.

Look at the error logs of your server to see more information.

Alternatively, disable short URLs by setting $wgUsePathInfo to false.

Watchdream (talkcontribs)

Thanks for the last advice with $wgUsePathInfo, that helped me and solved the problem.

Атомный трамвай (talkcontribs)

Same problem. Additionally, I can say that I don't have any special rules for images, except length of expiration. I use short URL, too. I don't want to turn it off. Maybe, is there some special logs helping me by looking into?

Ciencia Al Poder (talkcontribs)

If you're really sure the problem are not your rewrite rules (that we can't tell you because you didn't provide them nor pointed to your site), if you're on a shared host, ask your hosting provider, since some of them have custom rules in place for images that may do weird things like this. Maybe they can disable those conflicting rules for you.

Атомный трамвай (talkcontribs)

Well, my site is янтарнаяноосфера.рф. The file that was successfully uploaded, but isn't accessible now: http://янтарнаяноосфера.рф/0/Файл:Карта_севера_Пруссии_с_путями_без_границ_(220_пикс).png.

That's a part of my nginx confug:

        location / {

                try_files       $uri $uri/ @rewrite;
                location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
                        expires     max;
                }
                location ~ [^/]\.php(/|$) {
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        if (!-f $document_root$fastcgi_script_name) {
                                return  404;
                        }
                        fastcgi_pass    127.0.0.1:9002;
                        fastcgi_index   index.php;
                        include         /etc/nginx/fastcgi_params;
                }
        }
        location @rewrite {
                rewrite ^/(.*)$ /index.php;
        }

I have VDS. There is another inage, http://янтарнаяноосфера.рф/0/Файл:Кёнигсбергский_замок.jpeg. Even no thumbnail was created for it. Guess I have made some changes, but I am not sure, which is. I used page name like %domain%/wiki/%pagetitle%, later I replace /wiki/ — maybe it had some fatal influence.

Ciencia Al Poder (talkcontribs)

Does it make sense to have the wiki under a /0/ directory?

Anyway, try a structure like this:

    location /wiki/ {

        rewrite ^/wiki/(?<pagename>.*)$ /index.php;

        fastcgi_pass 127.0.0.1:9002;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        fastcgi_param PATH_INFO $pagename;
        fastcgi_param QUERY_STRING $query_string;

        break;
    }
    location ~ /(index|load|api|thumb|opensearch_desc)\.php$ {
        fastcgi_pass 127.0.0.1:9002;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
    }
Атомный трамвай (talkcontribs)

Finally... great thanks and all the blessing that you recognize! My VestaCP keep enjoying me by changing conf structure. So, all the rewrite rules I have made to nginx conf was lost. However, it means that Short URL can work out almost completely only LocalSettings-sidely. I could see muself that I don't have any special rules in conf file, though I did them. This kind of silly mistakes that are visible only from the side. Thanks again. Now it works.

Атомный трамвай (talkcontribs)

But wait. Problem with creating thumbnails remains. Any image I try to upload don't have thumbnail.

Ciencia Al Poder (talkcontribs)

Open the thumbnail URL and see if the URL "makes sense" with the location where it should be on the server. If it makes sense, see in the server if the thumbnail actually exists

Атомный трамвай (talkcontribs)

It's not a real directory, actually. Just some language-independent thing in URL, nothing more. OK, I shall try.

Reply to "[RESOLVED] MW 1.23.3 - "404 Not Found" then I try open uploaded images or generate thumbnails"