apache2: bad user name ${APACHE_RUN_USER}
Posted by admin on April 27 2011 15:01:54
If you have the following problem, when you try to start apache web server and you receive the following error code

apache2: bad user name ${APACHE_RUN_USER}

If you run the command "apache2ctl -S" you will se the syntax is OK. But why this error is shown again and again?

# These need to be set in /etc/apache2/envvars
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

# or here /etc/apache2/apache2.conf
User www-data
Group www-data

To fix this problem, You can statically define user and group in your apache.conf

User www-data
Group www-data

But what if you need to use apache started as different user than www-data ?
You need to change Apache user and group, you can do this in the following files and lines:

# These change needs to be set in /etc/apache2/envvars
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

# or here /etc/apache2/apache2.conf
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}