Warning: Undefined variable $html in /usr/share/nginx/html/lib/plugins/tabinclude/helper.php on line 240
Wordpress
- Common Wordpress Issues
- global/restrictions.conf
- Permalinks/Rewrites
- XMLRCP.php
- Add Admin User Manually
Quick Wordpress Files Download
Change /var/www/html to the directory you wish to download the latest wordpress files and the following command will download the files
1 |
wget -O - https: //wordpress .org /latest . tar .gz | tar -xzf - -C /var/www/html --strip-components=1 |
Wordpress Permissions
Replace ${WP_ROOT} with the directory location of wordpress. If you are already in the wp document root, replace with a dot .
1 2 3 |
find ${WP_ROOT} - exec chown :apache {} \; find ${WP_ROOT} - type d - exec chmod 755 {} \; find ${WP_ROOT} - type f - exec chmod 644 {} \; |
Auto Install Plugins (without FTP/FTPs details)
vim /var/www/vhost/website/wp-config.php
1 |
define( 'FS_METHOD' , 'direct' ); |
Install Plugins with FTP (auto)
1 2 3 4 5 6 7 8 9 |
define( 'FTP_BASE' , '/var/www/vhosts/example.com/httpdocs/' ); define( 'FTP_CONTENT_DIR' , '/var/www/vhosts/example.com/httpdocs/wp-content/' ); define( 'FTP_PLUGIN_DIR ' , '/var/www/vhosts/example.com/httpdocs/plugins/' ); #define('FTP_PUBKEY', '/var/www/vhosts/example.com/httpdocs/.ssh/id_rsa.pub'); #define('FTP_PRIKEY', '/var/www/vhosts/example.com/httpdocs/.ssh/id_rsa'); define( 'FTP_USER' , 'FTPusername' ); define( 'FTP_PASS' , 'FTPpassword' ); define( 'FTP_HOST' , 'localhost' ); define( 'FTP_SSL' , false ); |
WP Memory Limit
To increase the memory limit for wordpress you should first change the php.ini file.
If that does not work you should add the following to your wp-config.php file
1 |
define( 'WP_MEMORY_LIMIT' , '96M' ); |
Changing Site URL
Check the current URL, first select the database with the 'use' command (eg. use live_database;):
1 |
SELECT * FROM wp_options WHERE option_name = 'siteurl' OR option_name = 'home' ; |
1 |
UPDATE wp_options SET option_value = 'http://lukeslinux.co.uk' WHERE option_name = 'siteurl' OR option_name = 'home' ; |
Deterring wp-login attacks
Add the following to your htaccess.
The following code stops any ip address posting to your wp-admin page that does not have a referrer or user-agent set.
An example log entry is:
1 |
x.x.x.x - - [23 /Aug/2016 :17:25:40 +1000] "POST /wp-login.php HTTP/1.0" 403 214 "-" "-" |
1 2 3 4 5 6 7 8 |
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_METHOD} POST RewriteCond %{HTTP_REFERER} !^https: // (.*)?reaa\.com\.au [NC] RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR] RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$ RewriteRule ^(.*)$ - [F,L] < /IfModule > |