0

How can i get Apache to run as www-data?

Apache wont run as www-data. ps aux prints:

root     24525  0.0  0.3  69652  8932 ?        Ss   12:22   0:00 /usr/sbin/apache2 -k start
root     24533  0.0  0.1  69652  4260 ?        S    12:22   0:00 /usr/sbin/apache2 -k start
root     24534  0.0  0.1  69652  4248 ?        S    12:22   0:00 /usr/sbin/apache2 -k start
root     24535  0.0  0.1  69652  4248 ?        S    12:22   0:00 /usr/sbin/apache2 -k start
root     24536  0.0  0.1  69652  4248 ?        S    12:22   0:00 /usr/sbin/apache2 -k start
root     24537  0.0  0.1  69652  4248 ?        S    12:22   0:00 /usr/sbin/apache2 -k start

I expect the first process to be run as root since i need to bind to 81 but the rest i want running as www-data.

My config envvars file contains

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

And my apache2.conf contains:

# These need to be set in /etc/apache2/envvars
User www-data
Group www-data 

(I hard coded these as a desperate attempt)

I have even tried to run /usr/sbin/apache2 -c "User www-data" with no luck.

nginx runs as www-data, so i assume that the users exists and works.

The error.log shows only:

[Wed Jun 18 14:07:53 2014] [notice] Apache/2.2.16 (Debian) PHP/5.3.3-7+squeeze19 with Suhosin-Patch configured -- resuming normal operations
5
  • What distribution do you use? What is the error message what you get ?
    – Sacx
    Jun 18, 2014 at 10:44
  • Debian Squeeze. I dont get any error messages from what i can see.
    – ErikTJ
    Jun 18, 2014 at 11:31
  • Is running as root even if you start it with: service apache2 start?
    – Sacx
    Jun 18, 2014 at 11:38
  • Well, did you compile it from source or did you install it via apt-get install apache2 ? By default it will run as www-data on Squeeze.
    – beta
    Jun 18, 2014 at 11:49
  • I got it from apt. And yes, it runs at root even then.
    – ErikTJ
    Jun 18, 2014 at 12:01

1 Answer 1

0

I will probably never know what caused this, but a apt-purge of apache2 and all it's dependencies, then a reinstall through apt-get made it work again.

Thanks to all of you who tried to help me.

You must log in to answer this question.

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