Installing WordPress 4.9.4 on Debian 9.3

03/02/2018


Install apache2

apt-get install -y apache2 mariadb-server php php-mysql php-zip php-gd unzip

php-xml php-mbstring php-curl


Setup MySQL Database

Change wpuser and wppass to a username and password that you want for your owncloud database

mysql -e "CREATE DATABASE wordpress;"
mysql -e "GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost' IDENTIFIED BY 'ocpass';"
mysql -e "FLUSH PRIVILEGES;"

Setup apache2

rm /etc/apache2/sites-enabled/000-default.conf
nano /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName shawnshank.com

  DocumentRoot /var/www/wordpress
  <Directory />
      Options FollowSymLinks
      AllowOverride None
  </Directory>
  <Directory /var/www/wordpress>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
service apache2 restart

Get WordPress Files

wget https://wordpress.org/latest.zip
unzip latest.zip -d /var/www

Securing WordPress

Set proper permissions for 'data' folder

chown -R www-data:www-data /var/www/wordpress/
chmod -R g+s /var/www/wordpress/

Set max upload

/etc/php/7.0/apache2/php.ini

Change the following:

upload_max_filesize = 2M
post_max_size = 8M 

Change them to:

upload_max_filesize = 200M
post_max_size = 300M
service apache2 restart