Installing WordPress 4.9.4 on Debian 9.3


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';"

Setup apache2

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

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

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

service apache2 restart

Get WordPress Files

unzip -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


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