problems with mediawiki behind nginx / apache (redirects to wrong url)

Gelonida N gelonida at
Sun Sep 11 18:13:32 UTC 2011


I'm having a little trouble to get Mediawiki working in my nginx setup.

The problem is very probably the configuration of Mediawiki, but the
Help pages about Mediawiki don't mention nginx.
So I thought I ask here.

My Problem:
- I setup nginx with https such, that it handles all files, except php
files, which fill be proxied to apache/mod_php at port 8081

- I installed a new Mediawiki

- the installation via the web worked fine and was confirmed
    with a success message

- then I moved config/LocalSedttings.php  to the wiki directory

Now I access https:/servername/wiki2/
and get redirected to http://servername:8081/wiki2/index.php/Main_Page

Below my nginx configuration:

# ============== nginx configuration ========
server {
    listen       443 ssl;
    ssl_session_timeout  10m;
    ssl_session_cache    shared:SSL:10m;

    location ~ \.(php)$ {
        include proxy.conf;

    # nginx shall serve all files except the php ones
    location / {
        root   /my/doc/root;
        index  index.html index.htm index.php;

# ==================== proxy.conf ==============
proxy_redirect     off;

proxy_set_header   Host             $host;
proxy_set_header   X-Real-IP        $remote_addr;
proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

client_max_body_size       10m;
client_body_buffer_size    128k;

proxy_connect_timeout      90;
proxy_send_timeout         90;
proxy_read_timeout         90;

proxy_buffer_size          4k;
proxy_buffers              4 32k;
proxy_busy_buffers_size    64k;
proxy_temp_file_write_size 64k;

Thanks in advance for any pointers.

More information about the nginx mailing list