• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Wordpress website errors with Nginx after Migration

Xavier12

Regular Pleskian
Hi guys,

For some reason I am receiving nginx errors after migrating all sites to a new plesk server. It seems only the default permalinks are allowing the websites to work, but custom permalinks aren't working.

Please advise, thanks.

Error page below.
Not Found
The requested document was not found on this server.
 
Please read carefully "http://codex.wordpress.org/Nginx#General_WordPress_rules" and use additional http/https and nginx directives over the Plesk Control Panel, in your webserver settings of each domain, when you use wordpress and plugins.

Be aware that each wordpress site might need additional rewrite rules, depending on your used plugins. There is no general configuration for all wordpress installations, when you use plugins.
 
Hey there,

Thanks for the response. From my understanding, Plesk already has the wordpress nginx directives built in by default. I found this out when I first used plesk and manually added the directives within the custom section of nginx.. but came to realization shortly after that the directives for the custom permalinks weren't needed and worked without manually adding them to plesk's extra nginx configuration..

Please let me know if this is incorrect.. But I do know that the Last plesk installation didn't require me to put the custom permalinks directive for nginx, and I never modified the original nginx.conf and or the vhosts files. Never hard this issue with custom permalinks either

Please advise, thanks
 
Last edited:
Btw. also added the directive below:

location ~ /$ {
index index.php index.cgi index.pl index.html index.xhtml index.htm index.shtml;
try_files $uri $uri/ /index.php?$args;
}

Still the same issue appears. Is there a nginx resync to all websites command? I also tried this: /usr/local/psa/admin/bin/httpdmng --reconfigure-all

No luck


Please let me know if there any specific logs required to provide to make it easier? On debian 7 x64
 
Last edited:
Have you tried this...

Go to

Plesk -> Domains -> Yourdomain.tld -> Web Server Settings -> Additional nginx directives

Add...

Code:
# Wordpress permalinks
if (!-e $request_filename) {
  rewrite ^(.*)$ /index.php?q=$1 last;
  break;
}


To get the Permalinks to work properly.
Hope it helps
Regards

Lloyd
 
Hi Lloyd, thanks for the response and effort :)

But it seems I ended up having to work around this issue by re-migrating with "all system configuration files" option checked when migrating. Nonetheless, the migration option should still be smooth and not cause the server to be stuck with non-working custom permalink issues for wordpress after transferring. I believe this may be a bug because all server settings on the previous plesk installation were the exact same as they were before with no required nginx modifications. I can say this also because I matched both servers default nginx, php configuration, and domain specific nginx config files and they both matched with the same info. There may be something else that isn't being copied over during migration, I mean, unless I am missing something?

Before I didn't need to add nginx directives anywhere in plesk for custom wordpress permalinks to work in my previous plesk setup.

Just a heads up
 
Before I didn't need to add nginx directives anywhere in plesk for custom wordpress permalinks to work in my previous plesk setup.

I can confirm that. It seems Wordpress could apply a nginx configuration on its own until a few weeks ago. A few days ago I noticed suddenly, that W3TC (WP-Plugin) on a fresh site (same server) suddenly wrote nginx.conf files in webroot-dir. Configuration was no longer applied.
I am not sure if Wordpress or Plesk changed something here. Right now looking on how it worked before.

Any tipps and advice appreciated.
 
I can confirm that. It seems Wordpress could apply a nginx configuration on its own until a few weeks ago. A few days ago I noticed suddenly, that W3TC (WP-Plugin) on a fresh site (same server) suddenly wrote nginx.conf files in webroot-dir. Configuration was no longer applied.
I am not sure if Wordpress or Plesk changed something here. Right now looking on how it worked before.

Any tipps and advice appreciated.

Depending on your wordpress plugin usage, you might have to add additional rewrite rules. For example here, you pointed out "W3 Total Cache", which in the meantime creates a helpfull additional nginx.conf, based on your settings at wordpress for this plugin. If you only use apache, the plugin mostly has no problems in creating htaccess - rules and placing them into your domain - folders, but these rules don't work for nginx. That is why the developers decided to create these helpfull additional nginx - configurations, which you normally just have to copy over the Plesk Control Panel at your webserver settings in order to get the plugin work as expected as well with nginx. Plesk is not reading the W3 Total Cache additionally created nginx.conf on his own, because it is located in your domain - docroot - folders, but the domain specific config files are stored in folders, where the user www-data and/or psacln can't read and write.

No, in former times, Plesk wasn't reading such additional nginx - configurations on his own, but your wordpress settings might not have needed additional seetings ( for example, no additional cache settings were made ), so nginx didn't need additional rewrite rules.
 

You basically wrote, what we knew in this thread and added parts of my post above. Thank you - I knew as much.

Problem before "this change" (seriously - no kidding):
- no nginx.conf file in webroot
- no additional rules applied to nginx (nada, zero, nothing, nichts)
- nginx serving php via php-fpm

Result: any rewrite rule was performed as if there was a ruleset in nginx. Now it doesnt any longer.

My assumption: nginx rules before sent any server 404 - file to apache (including php) and now nginx directly answers 404. So basically the 404 rules in nginx were added.

Problem: I didnt find those in the old configuration. Maybe a bug before or a bug now?
 
Hi Martin_Sauer,

without going to deep into a "PATH_INFO" and "SCRIPT_FILENAME" discussion, the mentioned former configuration was vulnerable, giving nginx the opporunity to execute ALL files - not only php files in your docroot. As this is a very bad idea, the made changes increase the server security, even if that means, that you now have to configure a bit more than before on your own - and "no"... it's not a bug. ^^
 
without going to deep into a "PATH_INFO" and "SCRIPT_FILENAME" discussion, the mentioned former configuration was vulnerable, giving nginx the opporunity to execute ALL files - not only php files in your docroot. As this is a very bad idea, the made changes increase the server security, even if that means, that you now have to configure a bit more than before on your own - and "no"... it's not a bug. ^^

@UFHH01 Thanks alot, you just saved me from diving into that part (comparing production server with test server config and debugging nginx/Apache confs).
 
Oh man, that means I will have to install another Plesk server with the default new protected configuration?? It seems my previous migration may have copied the configuration that was patched based on what you are saying UFHH01.

Please advise as soon as possible. Thnx!
 
Hi Xavier12,

I wonder what makes you think now, that you have to install a new server? If your system is up-to-date and you installed all Plesk patches as well, there wouldn't be any difference on a new server.
The only thing that you have to worry about is the fact, that you have to use additional rewrites rules in some cases, which might cause a little more "own" work on the servers, when you use nginx. Just use the mostly provided suggestions from wordpress and/or their developers or use the Plesk htaccess-to-nginx converter ( free Plesk-extension, which integrates itself into each domain webserver settings section ) - which works pretty well for common apache rewrite rules.
 
Oh man, that means I will have to install another Plesk server with the default new protected configuration?? It seems my previous migration may have copied the configuration that was patched based on what you are saying UFHH01.

Please advise as soon as possible. Thnx!

- Install Webserver Configurations Troubleshooter Extension.
- regenerate webserver configuration either for all or on a host by host basis
- Voilá

No need for reinstallation :)

(PS: This is Unix, not Windows :D )
 
Hi Xavier12,

I wonder what makes you think now, that you have to install a new server? If your system is up-to-date and you installed all Plesk patches as well, there wouldn't be any difference on a new server.
The only thing that you have to worry about is the fact, that you have to use additional rewrites rules in some cases, which might cause a little more "own" work on the servers, when you use nginx. Just use the mostly provided suggestions from wordpress and/or their developers or use the Plesk htaccess-to-nginx converter ( free Plesk-extension, which integrates itself into each domain webserver settings section ) - which works pretty well for common apache rewrite rules.

Hi UFHH01,

Thanks for this.. We actually only use Nginx and never apache (I don't see a reason why anyone would want to use apache at this point, nginx is godsent, lol)
 
- Install Webserver Configurations Troubleshooter Extension.
- regenerate webserver configuration either for all or on a host by host basis
- Voilá

No need for reinstallation :)

(PS: This is Unix, not Windows :D )

And you my friend, are awesome! :) Thank you very much for this
 
Back
Top