1

I am setting up Drupal Open Atrium, and halfway through the configuration receive an error:

Clean Urls must be available and enabled to use OpenAtrium.

https://www.drupal.org/docs/7/configuring-clean-urls/enable-clean-urls tells me to run sudo a2enmod rewrite, which happens:

Enabling module rewrite.
To activate the new configuration, you need to run:
service apache2 restart

but when I then run sudo service apache2 restart I get the following error:

Job for apache2.service failed because the control process exited with error code. 
See "systemctl status apache2.service" and "journalctl -xe" for details.

systemctl status apache2.service returns:

● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
       └─apache2-systemd.conf
 Active: failed (Result: exit-code) since Mon 2017-04-03 18:21:04 UTC; 7s ago
 Docs: man:systemd-sysv-generator(8)
Process: 11268 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 11345 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]:  *
Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]:  * The apache2 configtest failed.
Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]: Output of config test was:
Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]: apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/rew
Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]: Action 'configtest' failed.
Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]: The Apache error log may have more information.
Apr 03 18:21:04 ip-172-31-31-251 systemd[1]: apache2.service: Control process exited, code=exited status=1
Apr 03 18:21:04 ip-172-31-31-251 systemd[1]: Failed to start LSB: Apache2 web server.
Apr 03 18:21:04 ip-172-31-31-251 systemd[1]: apache2.service: Unit entered failed state.
Apr 03 18:21:04 ip-172-31-31-251 systemd[1]: apache2.service: Failed with result 'exit-code'.

The problem sorts itself out with a a2dismod rewrite, but then I'm back where I started.

My /etc/apache2/mods-enabled/rewrite.load looks like this, if that's the trouble.

LoadModule rewrite_module modules/mod_rewrite.so

How can I get the rewrite mod to work with apache?

1 Answers1

2

This was finally solved by using sudo apache2ctl graceful and following the file links from the error messages, for example:

apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/rewrite.load: LoadModule takes two arguments, a module name and the name of a shared object file to load it from
Action 'graceful' failed.
The Apache error log may have more information.

In the end, I removed the AddModule mod_rewrite.c from the rewrite.load that was suggested by Drupal, and changed the link from modules/mod_rewrite.so to /usr/lib/apache2/modules/mod_rewrite.so which is where it actually was (found with sudo find / -name mod_rewrite.so)

I then restarted apache, and everything worked!