robsnider
7/21/2017 - 8:20 PM

Wordpress

Wordpress

https://deliciousbrains.com/hosting-wordpress-setup-secure-virtual-server/

https://mygisnotes.wordpress.com/2015/10/04/install-wordpress-under-ubuntu-and-enable-automatic-updates/

#Quick Install# https://askubuntu.com/questions/621431/best-practive-for-wordpress-updates

sudo apt-get install apache2 libapache2-mod-php5 php5-mysql mysql-server ## write down password for mysql root user
sudo service apache2 reload
wget https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
sudo mv wordpress/ /var/www/html/
sudo chown -R www-data.root /var/www/html/wordpress/

mysql -u root -p ##enter password at prompt
create database my_wordpress;
create user 'my_wordpress'@'localhost' identified by 'my_password';
grant all on my_wordpress.* to 'my_wordpress'@'localhost';
exit

#File Permissions# https://www.smashingmagazine.com/2014/05/proper-wordpress-filesystem-permissions-ownerships/

  • All files should be 664.
  • All folders should be 775.
  • wp-config.php should be 660.

#Server Users and Groups#

First, we need to adjust the file and folder ownerships of our WordPress files. We’ll have to make sure of the following:

  • that your user account is the owner of all WordPress files and folders,
  • that your user account and the Web server’s user account belong to the same group.

To find out the groups that your user account belongs to, you can use this command in your server’s terminal:

groups

Then, to find out the groups that your Web server belongs to, you can temporarily insert this PHP snippet in one of your WordPress scripts:

echo exec( 'groups' );

If your user and the Web server don’t belong to the same group, you can use the following command in the terminal to add your user to one of your Web server’s groups: sudo usermod -a -G <a-common-group-name> myuser

Lastly, to ensure that everything in our WordPress folder belongs to our user account and has the shared group that we just added, perform this command in your WordPress folder: sudo find . -exec chown myuser:a-common-group-name {} +

#404 Redirects# Add to wp-config.php

define('WP_SITEURL', 'http://websiteurl.com');
define('WP_HOME', 'http://websiteurl.com');