Search code examples
apacheubuntuphpsuexec

Q: Ubuntu 14.04 + Apache + suexec + php5-fpm run as user and group?


i'm trying to install a apache2 on ubuntu 14.04 with mod_suexec and php5-fpm. What i want is, that the php scripts are running as the user and group that i've set in the fpm pool.conf for the virtual host. but it already runs as www-data. the tutorials i've found just explain how to setup php fpm on listening on a port with ProxyPassMatch or on a socket, but not explaining why or how to run it as an alternative user.

i've read that apache 2.4 in the ubuntu 14.04 packages could only run with the port listening fpm method, but how could i solve it on that way to run scripts with different pool configurations an run under the user set in the pool conf?

thanks a lot


Solution

  • Resolved it by setting each pool for a user with different Port listening on. After that RegexProxyPassMatch in the vhost includes the port.

    To get unique port numbers i'm calculating with the user UID like this in a bash script

      BASEPORT=20000
      USRID=`id -u $1`
      NEWPORT=`echo $((USRID+BASEPORT))`
    

    and write it into the pool and vhost conf.

    thats all