Welcome! Log In Create A New Profile

Advanced

try_files setup

Artur
July 10, 2015 11:18AM
Hello,

I'm quite new to the advanced nginx configuration so I will need your
help. :)

I'm currently working on a nginx + php5-fpm (chrooted) + wordpress setup.
My basic setup works fine but I wanted to improve the try_files section.

My main concern is to correctly take in charge URIs by nginx or php5-fpm
depending on their types and existence.

My current setup for wordpress with nice permalinks
(http://host/wordpress_page/) :

location / {
root /content/chroot/htdocs;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
include fastcgi_params;
root /htdocs;
fastcgi_pass 127.0.0.1:1234;
fastcgi_param SCRIPT_FILENAME $document_root$request_filename;
}

error_page 404 /404.html;
#location = /404.html {
# root /usr/share/nginx/html;
#}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

The main problem is that if I try to get a non existing php file
(http://host/nonexisting.php) I get always "No input file specified."
fpm error.
I'd like to redirect here to a 404 error page instead.

In case I call a different non existing file (nonexisting.jpg) I get an
error displayed from Wordpress saying this page does not exist. I
suppose this is correct in a wordpress setup because of the permalinks
setup I described above.

Any help will be appreciate. :)

--

Best regards,
Artur.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

try_files setup

Artur July 10, 2015 11:18AM

Re: try_files setup

Artur July 17, 2015 11:42AM

Re: try_files setup

mike-pt July 17, 2015 12:22PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 308
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready