Plesk 11.5 is still in beta, but shows a lot of potential due to its handling of PHP via PHP-FPM. When active in Plesk 11.5+ PHP-FPM is not properly re-writing WordPress page URLs, and is appending index.html at the end of each URL, causing a 404 error. We have reported the bug to Parallels. In the meantime, the solution can be solved by creating custom nginx.conf directives, either from the command line, or via the Plesk panel.

The Solution code

Adding the code via Plesk Panel

To do this via Plesk Panel, go to the domain's Web Server settings. At the bottom of the page (where PHP-FPM is activated), there will be a field for ‘Custom NGINX Directives'. Paste the code below into that box.

Adding the code via Command Line conf file

If you are wanting to do this from the command line, create a ‘vhost_nginx.conf' file, within the root/conf folder each vhost. For example /var/www/vhosts/domain.com/conf/vhost_nginx.conf'. In that vhost, add the following:

I tried this workaround with 11.5.30 #3 but I still get the nginx 404 errors when using permalinks. The WP site works fine with php-fpm and regular links. I noticed that ONLY with php-fpm enabled, wordpress doesnt offer me the pretty permalink option in settings unless I install the WP nginx plugin 2.7.2. I guess it tells WP that mod_rewrite is available. It works fine then with the index.php written into the URLs. What I don’t understand is why pretty permalinks work with nginx without the php-fpm option enabled but not with it being on. Only with php being handled by nginx via php-fpm the rewriting seems to fail resulting in the 404 error. Any ideas anybody?

Ruben Ortiz

HI

I have noticed that after add code to additional directives Web Stats (domain/plesk-stat) of Plesk fails. It returns a 404.

Interesting problem. You said that the rewriting seems to fail with the PHP, resulting in a 404 error. What are the error logs reporting when that happens? Can you paste the error? Also, can you paste your NGINX conf file?

timber

Sure. The parts I marked in bold are the lines that get added to the nginx cong when I enable php-fpm in Plesk. Without php-fpm it works fine.

Your settings look fine. This actually gave me the idea to write a new blog posting some of my PHP-FPM and NGINX CONF settings. I will try to do that in the next day or so. It’s very strange that the server isn’t generating an errors. That’s what I was hoping to see in your server logs, not necessarily the access logs. Try this command to see your errors:

Hi Mark – I think I understand what you’re trying to do. Instead of manually updated each domain vhost, you should be able to make that change directly from Plesk. I had to do exactly what you’re talking about in an earlier beta, but now any configurations added to the PHP Settings page within Plesk > Domain should stick. Have you tried that yet? Please let me know.

Hi Vinny, Yip I did use the Additional nginx directives form in the Web Server Settings tab. I stil have to manually delete the entire location ~ /$ directive from /etc/nginx/plesk.conf.d/vhosts/DOMAIN.conf and restart nginx from the command line 🙁 — Plesk Version: 11.5.30 Update #3, last updated at July 9