Plesk + WordPress: Homepage loads, but other pages don’t

I’ve only experienced this error when transferring databases from old WordPress installs on to new Plesk WordPress installs. After transferring the database, the homepage loads fine, but the rest of the site links produce a “Page not found” or a 404 error.

This is an easy fix, as you should still be able to reach your WordPress dashboard. Once there, all you have to do is go to Settings > Permalinks and Save without making any changes (technically just loading the page should do the trick).

Check to make sure this has fixed the issue, if not you may need to define you URL’s (something I may cover later).

Plesk: WordPress Permissions

I use WordPress on Plesk to host client sites.

On some of my client WordPress sites I started to run in to an issue when trying to update plugins, install themes, or modify files. The root cause was the permissions issue with WordPress when Plesk installed the application.

If you’re encountering permission errors on a Plesk installation of WordPress you’ll likely see a message like:

Could not create directory

There are two ways you can fix this. The first is the easiest, so I’ve always tried this first but for some installations it just doesn’t seem to get WordPress to play nicely.

First, log in to your Plesk installation via SSH.

ssh user@127.0.0.1

Where “user” is your username, or the root user and “127.0.0.1” is the IP address of your server. If you’re not using SSH keys you’ll be prompted for your password (enter that now if needed).

Next, you’ll want to run the prepackaged command that comes with Plesk and works for versions 11.5, 12, and 12.5.

/usr/local/psa/bin/repair --restore-vhosts-permissions

If you’ve entered this correctly you will see a message confirming that the permission have been reset. Return to WordPress, and try test to make sure it’s working. This will generally solve most issues, if you still get errors when modifying files you can then try manually adjusting the permission for WordPress inside of your Plesk installation.

Transfer back to your command line, or log in via SSH if you’re not still connected.

Now, you’ll need to navigate to your site folder.

cd /var/www/vhosts/your-site-name.com/

Then modify the permissions:

chown -R youruser:psacln httpdocs
chmod -R g+w httpdocs/wp-content
find httpdocs -type d -exec chmod g+s {} \;

Note that “your-site-name.com” and “youruser” must be replaced with the proper variables for your installation. Additionally, “youruser” is the user for this particular WordPress installation and not the SSH user that was used to log in to your Plesk server, though in some cases it may be the same (if you’re hosting for clients, it generally it isn’t).

I’ve still not found out why neither of these commands works 100% of the time, but between the two of them I’ve not been able to “not” solve a WordPress permissions issue using Plesk Onyx.

Plesk: smtp error (550): failed to add recipient internal domain

Fixing Local Email Deliverablity in Plesk when Email is Hosted Somewhere Else

The other day I ran in to an issue when I was transferring domains and email services in to Plesk. All of the email accounts could send out, and receive email with one exception. I could not send emails to two domains which have email hosted elsewhere, but have sites hosting on my Plesk installation. Roundcube kept spitting this error back at me:

smtp error (550): failed to add recipient internal domain

or this after fiddling with the tables in Postfix’s master.cf file:

Recipient address rejected: User unknown in virtual mailbox table

I couldn’t figure it out. I tried all of the articles I could find online. They almost all recommended changing settings inside Postfix, but to no avail. Changing the settings in main.cf and master.cf for Postfix, then restarting Postfix had no effect on how Plesk was trying to send the email.

Then it occurred to me. The default setting for Plesk is to create an email server for each domain, perhaps there was a way to disable this?

Sure enough, if you go to Domains > Select a Domain > Choose “Mail Settings” and you will find the checkbox to enable/disable “Activate mail service on this domain.” Once you’ve unmarked this checkbox email will use your DNS records to find the mail server, instead of trying to internally route the email through Plesk and Postfix.

A dumb oversight, for sure, but I just couldn’t find the answer available online.