Mediawiki can't display images or styles

2019-07-17 08:15发布

问题:

I`m using MediaWiki v1.19.1.

My wiki works well when I use it locally. But when I access it over the network (from another computer, or a different IP), it displays the text only. There are no images.

It seems like a classic skin but it`s not. The reason is that there is no layout on my wiki (other public wiki pages show ok).

My wiki uses the monobook skin now, but I can see only the text on the page.

I have changed the permission to 777, including on all directories (/var/www/kj/*), but still no images.

Help me, please...

回答1:

I got the same issue some time ago and the following worked fine for me. The issue might be related to the LocalSettings.php file and the general setting $wgServer.

The following link can provide you more details : Manual of $wgServer

Since 1.18 MediaWiki has also supported setting $wgServer to a protocol-relative URL.

eg, //www.mediawiki.org

This is used for supporting both HTTP and HTTPS with the same caches by using links that work under both protocols.

So try removing localhost and provide your URL; eg ; $wgServer = "//mywebsite.com";



回答2:

There's not enough information to give a definite answer, however general recommendations for such situations are:

  • If you're using any Apache rewrite rules (for example, to make URLs prettier), try disabling them.
    • Especially if you're using the http://example.com/Page_title style URLs, you should know that they're unsupported by the developers and require serious MediaWiki/Apache skills (and even then they will likely introduce subtle bugs).
  • Install Firebug and check what's the HTTP error for your images: is it because access is denied (HTTP 403) or the webserver doesn't see them at all (HTTP 404) - this should give you an idea what's going on.