Page 1 of 1

Wordpress Nginx + php fpm ERROR 404 with custom permalink

Posted: Tue Mar 01, 2016 11:40 pm
by kablakar
i have installed in a new server a vesta panel (php-fpm), when install wordpress and use custom permalink the response is 404 when visit a website , similar problem to this viewtopic.php?f=29&t=10657

i tried different template (wordpress,wordpress2) but not work anyway.

how solve this ?

Re: Wordpress Nginx + php fpm ERROR 404 with custom permalink

Posted: Wed Mar 02, 2016 7:58 am
by tjebbeke
Wordpress is using .htaccess files when you customize your permalinks. In PHP-fpm the .htaccess files aren't working so, you need to modify the templates.

https://codex.wordpress.org/Nginx

Re: Wordpress Nginx + php fpm ERROR 404 with custom permalink

Posted: Fri Mar 04, 2016 8:58 pm
by Clouseau
Php-fpm hasn't got anything to do with .htaccess files exept if there are options regarding php options (php.ini). The problem is that nginx doesn't read .htaccess files, it ignores them. So all those rewrites must be written in nginx configuration syntax...

Re: Wordpress Nginx + php fpm ERROR 404 with custom permalink

Posted: Sun May 01, 2016 3:12 pm
by daz1uk
Has anyone resolved this please?

Re: Wordpress Nginx + php fpm ERROR 404 with custom permalink

Posted: Sun May 01, 2016 3:40 pm
by daz1uk
Solved,

Add "try_files $uri $uri/ /index.php?$args;" to nginx.conf located at /home/user/conf/web/.

"try_files $uri $uri/ /index.php?$args;" Needs to be added to the location section of each website you host.

Re: Wordpress Nginx + php fpm ERROR 404 with custom permalink

Posted: Mon May 02, 2016 7:20 pm
by Falzo
you should rather edit the template you are using or create a new template based on another with your changes.

otherwise you're changes to those config files mentioned are _not_ permanent and will be overwritten next time you change something in vesta controlpanel regarding the domain settings.

Re: Wordpress Nginx + php fpm ERROR 404 with custom permalink

Posted: Mon Oct 17, 2016 4:04 pm
by lotusming
Hey guys, I noticed i still get a 404 when I enabled letsencrypt SSL on the wordpress domain. Otherwise permalinks work fine with the location block above.

Re: Wordpress Nginx + php fpm ERROR 404 with custom permalink

Posted: Tue Jun 25, 2019 7:35 pm
by bgbs
You need to head over to /home/user/conf/web/youdomain.com.nginx.conf

And add this line between inside location / { }

Code: Select all

index index.php index.html;
        if (!-e $request_filename)
        {
                rewrite ^/(.+)$ /index.php last;
        }