0

I know the thread Apache2 config variable is not defined but here the problem is most probably about ownership/permissions of the newly created user, see the bottom of the thread for the hypothesis of the problem. I run in Raspbian Jessie

sudo a2enmod headers

and

  • My /etc/apache2/envvars is the same as here.
  • I successfully did self-signed SSL certificate as described here; openssl s_client -connect localhost:443 returns the expected output.

I run sudo apache2 -k graceful but the output is

 [Tue May 31 14:47:38.182913 2016] [core:warn] [pid 5212] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Mon Apr 21 17:36:38.019345 2016] [core:warn] [pid 5212] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Mon Apr 21 17:36:38.019370 2016] [core:warn] [pid 5212] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Mon Apr 21 17:36:38.019385 2016] [core:warn] [pid 5212] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Mon Apr 21 17:36:38.019414 2016] [core:warn] [pid 5212] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Apr 21 17:36:38.028756 2016] [core:warn] [pid 5212] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Apr 21 17:36:38.029032 2016] [core:warn] [pid 5212] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Apr 21 17:36:38.029056 2016] [core:warn] [pid 5212] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

Doing source /etc/apache2/envvars and running the command gives still the same output. I am not sure about the problem.

HBruijn's proposals

  • The command sudo service apache2 graceful seems to work; output [OK] Reloading webserver: apache2. Is that ok? What should I check then? Why was the original error there?
  • The command sudo apache2ctl graceful returns then again just an empty line. Is that OK?

Why are you getting such an output with apache2 -k graceful?

4
  • 1
    A bare redirect (with a >) after a sudo command does not run with elevated permissions, but with the permissions of the original user, a common misconception and the probable cause for your permission denied issue.
    – HBruijn
    May 31, 2016 at 16:44
  • 1
    Redirect to /tmp/ or another directory where the original user can write...
    – HBruijn
    May 31, 2016 at 16:55
  • 1
    Your actual problem is similar to the q&a you referenced you're calling the apache2 directly rather than using a wrapper that sets up a working environment first. I would hope the init script is good and sudo service apache2 graceful works or apache2ctl
    – HBruijn
    May 31, 2016 at 17:04
  • @HBruijn The command sudo service apache2 graceful seems to work; output [OK] Reloading webserver: apache2. Is that ok? What should I check then? Why was the original error there? The command sudo apache2ctl graceful returns then again nothing, just empty line. Is that OK? May 31, 2016 at 17:09

1 Answer 1

1

On debian You should use service apache2 ... or apache2ctl script.

apache2 is the binary and calling it directly doesn't set all environment variables required by the config.

apache2ctl graceful returning nothing is normal.

4
  • But why apache -k graceful returns the error then? May 31, 2016 at 17:29
  • Because it's missing {APACHE_LOCK_DIR} and other enviroment variables which are set in apache2ctl script, gracefull still has to parse the config file and it con't do it without correct enviroment.
    – Lazy404
    May 31, 2016 at 17:38
  • How would it be correct with apache2 -k graceful? May 31, 2016 at 17:54
  • It won't be correct. You have to use apache2ctl.
    – Lazy404
    May 31, 2016 at 17:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .