Nginx won't rewrite after sending paste
Closed this issue · 6 comments
Deleted user commented
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,
Deleted user commented
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.
jvoisin commented
Did you managed to get it working?
jvoisin commented
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.
Deleted user commented
That's perfect, as you say /
should match first.
Thanks !
Doshirae commented
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
jvoisin commented
Iirc, it was nginx' default one.