You are not logged in.

#1 2011-01-13 14:10:55

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

[Solved] nginx and ssh tunnel

Before posting this in their forums, I thought someone here might know the answer. My problem is this: I've setup mediawiki with nginx, only accessible from localhost (port 80), and it is working fine. The problem is, that I want to be able to access it remotely from an ssh tunnel (ssh is config in the same machine of nginx and mediawiki). The problem is that when I do something like this:

ssh -L8000:localhost:80 <my_host_public_name>

When I then do this in the browser: http://localhost:8000, nginx will redirect it to http://localhost/index.php, which fails because it is directing the request to port 80.

Here's the relevant section of nginx.conf:

server {
        listen       80;
        server_name  localhost;
        root         /srv/http/mediawiki;
        index        index.php;

        location / {
            try_files $uri $uri/ @mediawiki;
        }

        location @mediawiki {
            rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2 last;
        }

It's the first time I'm using nginx; am I possibly using the wrong rewrite rules?

Thanks in advance.

Last edited by gauthma (2011-01-13 16:15:41)

Offline

#2 2011-01-13 16:13:03

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [Solved] nginx and ssh tunnel

It turns out that the problem has nothing to do with nginx: it's mediawiki that does the redirect, and fails to take into account the redirect port. In an nginx setup without mediawiki, such a redirect would (IMHO) not suffer of this problem.

Offline

Board footer

Powered by FluxBB