Since I'm new to administering Wordpress, I'm listing below some solutions to some of the issues fixed on some of our servers.
Exporting and importing the database -
https://ubuntu.com/tutorials/Initially I had set up a wordpress site with WP-CLI since auto updates and installing of plugins were not working via the web console. Later, the web-based administration was fixed by changing ownership of the files to the webserver,
sudo chown the-wp-directory www-data:www-data
The site did not need 777 permissions, 744 seemed to be working.
But here are some of the useful WP-CLI commands.
https://kinsta.com/knowledgebase/disable-wordpress-plugins/
Rename public/wp-content/plugins folder to plugins_old, log in, then rename it back to plugins.
domain.tld/?postname
it would work. So, it was some issue with the Permalinks setting. Though I checked that the .httpdocs was writable and so on, the wordpress url-rewrite was not working. So, had to manually copy-paste the following code to the end of the .htaccess file in the root directory, as per the advice at this page -
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
enabling mod_expires with
https://unix.stackexchange.com/questions/694530/enable- mod-expires-on-apache
sudoa2enmod expires headers
https://lindevs.com/install-tidy-on-ubuntu gave the method for installing tidy.
But for tidy, we need the php extension and not above.
sudo apt install php-tidy
https://linuxhint.com/install-latest-php-ubuntu22-04/
For testing the sites, I had edited the hosts file to point the browser to the new server -
sudo nano /etc/hosts on Linux
AFTER chown www-data for all files under wp directory, deleting inactive plugins from the Network admin web console solved the issue.
- “mysql -u root -p” (log in to MySQL)
- enter your mysql password
- “use (name-of-database)” (select WordPress database)
- “show tables;” (you’re looking for a table name with “users” at the end)
- “SELECT ID, user_login, user_pass FROM (name-of-table-you-found);” (this gives you an idea of what’s going on inside)
- “UPDATE (name-of-table-you-found) SET user_pass=”(MD5-string-you-made)” WHERE ID = (id#-of-account-you-are-reseting-password-for);” (actually changes the password)
- “SELECT ID, user_login, user_pass FROM (name-of-table-you-found);” (confirm that it was changed)
- (type Control-D to exit mysql client)
Edit: A list of items to secure a wordpress site - https://www.hostinger.in/tutorials/how-to-secure-wordpress