Config Test Failed When Restarting Apache2

Config Test Failed When Restarting Apache2

I am trying to install owncloud via WSL, but there is a problem with owncloud and php versions... Now I am getting this issue:

The apache2 configtest failed. Not doing anything.
Output of config test was:

apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 5 of /etc/apache2/sites-enabled/owncloud.conf: <IfModule takes one argument, Container for directives based on existence of specified modules
Action 'configtest' failed.
The Apache error log may have more information.
1

1 Answer

Enter into mysql:

sudo mysql

Create owncloud database:

mysql> CREATE DATABASE owncloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
mysql> GRANT ALL ON owncloud.* TO 'ownclouduser'@'localhost' IDENTIFIED BY 'change-with-strong-password';
mysql> EXIT;

Install apache2, php and its modules:

sudo apt install apache2 libapache2-mod-php7.2 openssl php-imagick php7.2-common php7.2-curl php7.2-gd php7.2-imap php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-pgsql php-smbclient php-ssh2 php7.2-sqlite3 php7.2-xml php7.2-zip

Allow apache in firewall:

sudo ufw allow 'Apache Full'

Download, extract owncloud and change its folder owner:

wget  -P /tmp
sudo unzip /tmp/owncloud-10.3.2.zip  -d /var/www
sudo chown -R www-data: /var/www/owncloud

Create owncloud.conf configuration file:

sudo nano /etc/apache2/conf-available/owncloud.conf

 Alias /owncloud "/var/www/owncloud/"

 <Directory /var/www/owncloud/>
   Options +FollowSymlinks
   AllowOverride All

  <IfModule mod_dav.c>
   Dav off
  </IfModule>

  SetEnv HOME /var/www/owncloud
  SetEnv HTTP_HOME /var/www/owncloud

 </Directory>

Enable the newly added configuration and all required Apache modules with:

 sudo a2enconf owncloud
 sudo a2enmod rewrite
 sudo a2enmod headers
 sudo a2enmod env
 sudo a2enmod dir
 sudo a2enmod mime

Reload apache2 service:

sudo systemctl reload apache2

Install ownCloud at the next address:


Reference

6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.