moulecorp/pasthis

Nginx won't rewrite after sending paste

Closed this issue · 6 comments

Hi there,

I get always a 404 error, my files.conf look like this:

server {
    listen 80;
    server_name paste.blah.org;

    root /srv/htdocs/paste.blah.org;
    index index.php;

    location / {
            if (!-e $request_filename){
            rewrite "^([a-zA-Z0-9]{6}(@raw)?)$" /index.php?p=$1;
            }
    }

    location /pasthis.db {
                deny all;
    }

    location ~ \.php$ {
                 include fastcgi.conf;
                 fastcgi_index index.php;
                 fastcgi_pass 127.0.0.1:9000;
    }
}

Thanks in advance for helping.
Cheers,

I try to debug a little more:

problem is a partial rewriting


^ here, a part of the url is missing:
index.php?p=

complete url rewriting obviously works


If I add the missing part manually everything works, looks like a problem in the rewriting command in your nginx.conf file.

Did you managed to get it working?

Here, it works great with this:

    server {
            listen 80;
            listen [::]:443 ssl http2;
            server_name p.[…].org;

            index index.php;

            location / {
                    if (!-e $request_filename){
                            rewrite "([a-zA-Z0-9]{6}(@raw)?)$" /index.php?p=$1;
                    }
                    include conf.d/php.conf;
            }

            location /pasthis.db {
                    return 404;
                    deny all;
            }
    }

I think that you should move your php stuff, since / will match first.

That's perfect, as you say / should match first.
Thanks !

Could I see the content of conf.d/php.conf
I have the exact same problem, but that doesn't work with how I do it

Iirc, it was nginx' default one.