0

Latest Wordpress running on Rocky 8.

With Permalinks set to Postname articles in the format of http://www.example.com/this-is-an-article/ return a 404.

Here is my Nginx conf file:

server { listen 80; server_name xyz.com www.example.com; root /db/docroot/www.example.com; index index.php; rewrite_log on; access_log /db/logs/host.access.log main; error_log /db/logs/example.debug.log debug; location / { root /db/docroot/www.example.com; index index.php; try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } 

}

1
  • Your canonical name and alternate name are on different domains. Your canonical name is using an apex record. You should probably considering using TLS. But no idea why your wordpress is not working. Maybe if you provided logs a description of what DOES happen when you try to resolve a permalink you might get more helpful answers. Commented Sep 27, 2024 at 15:58

2 Answers 2

0

Likely reason is:

try_file $uri =404; in your PHP location block. You should remove that, so that requests will go via FastCGI to the PHP-FPM, instead of trying to be served as static resources.

1
  • That was something I tried to make it work and bypass PHP-FPM. It fails the same way when it is removed. The fix was moving to Rocky 9, see my answer. Commented Sep 27, 2024 at 14:38
0

After many hours of trying to make this work I installed a new server with Rocky 9, rsync-ed my web root, database mysqldump and nginx/PHP-FPM conf files to the new server and Permalinks are now working. Not sure what the problem is with Rocky 8 (maybe PHP 7.4 vs PHP 8) but Rocky 9 is working fine.

1
  • The nginx config I posted works as is on Rocky 9 but remove the "try_file $uri =404;" as Tero pointed out for production so files are served via PHP-FPM. Commented Sep 27, 2024 at 14:42

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.