Tuesday, April 23, 2024
 Popular · Latest · Hot · Upcoming
31
rated 0 times [  31] [ 0]  / answers: 1 / hits: 69502  / 2 Years ago, sat, october 15, 2022, 11:24:55

My envvar files has these lines in it:



export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data


My apache2.conf has these lines in it:



# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}


But when I run apache2 -M I get this:



apache2: bad user name ${APACHE_RUN_USER}


A temporary fix is to hard-code www-data into it my apache2.conf file. There was some speculation here that this was because some configuration script didn't replace the env vars correctly in my apache2.conf file. Regardless how do I get apache2 to consult my envvars file?



As another data point this site seems to indicate the envvars is generated at build, but read by apache2ctl at runtime, suggesting that this file isn't just poop leftover by the build process.


More From » apache2

 Answers
5

After looking over the answer given by @Lekensteyn, I tried sudo apache2ctl -M with my apache2.conf reverted to the original. This worked so I dug into the man pages a bit. Here's what man apache2 had to say:



In  general, apache2 should not be invoked directly, but rather should 
be invoked via /etc/init.d/apache2 or apache2ctl. The default Debian
configuration requires environment variables that are defined in
/etc/apache2/envvars and are not available if apache2 is
started directly. However, apache2ctl can be used to pass arbitrary
arguments to apache2.


So, the answer to this question is: You're not using apache2 correctly; use apache2ctl instead.



Thanks @Lekensteyn for pointing me in the right direction.


[#37857] Sunday, October 16, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
finatch

Total Points: 49
Total Questions: 106
Total Answers: 94

Location: Kazakhstan
Member since Mon, Sep 26, 2022
2 Years ago
;