Running php-fpm and hhvm under standard linux user


#1

run php-fpm under a linux user

pool.conf file:

[@@USER@@]

listen = /var/run/@@USER@@_fpm.sock (tcp instead of .sock, for every site another tcp port is also possible)

listen.owner = @@USER@@ listen.group = @@USER@@ listen.mode = 0660 user = @@USER@@ group = @@USER@@

set file perms and create required dirs!

mkdir -p /home/$HOME_DIR$PUBLIC_HTML_DIR mkdir /home/$HOME_DIR/_logs mkdir /home/$HOME_DIR/_sessions chmod 750 /home/$HOME_DIR -R chmod 700 /home/$HOME_DIR/_sessions chmod 770 /home/$HOME_DIR/_logs chmod 750 /home/$HOME_DIR$PUBLIC_HTML_DIR chown $USERNAME:$USERNAME /home/$HOME_DIR/ -R

HHVM:

sudo cp /etc/init.d/hhvm /etc/init.d/hhvm_domain sudo cp /etc/default/hhvm /etc/default/hhvm_domain sudo cp /etc/hhvm/server_www_canus_at.ini /etc/hhvm/server_www_domain.ini

sudo vi /etc/init.d/hhvm_www_domain: … NAME=hhvm_www_domain … PIDFILE=/var/run/hhvm/pid_$NAME

/etc/default/hhvm_www_domain file:

This is a configuration file for /etc/init.d/hhvm.

Overwrite start up configuration of the hhvm service.

This file is sourced by /bin/sh from /etc/init.d/hhvm.

Configuration file location.

Default: “/etc/hhvm/server.ini”

Examples:

“/etc/hhvm/conf.d/fastcgi.ini” Load configuration file from Debian/Ubuntu conf.d style location

CONFIG_FILE="/etc/hhvm/server_www_domain.ini"

User to run the service as.

Default: “www-data”

Examples:

“hhvm” Custom ‘hhvm’ user

RUN_AS_USER="@@USER@@" RUN_AS_GROUP="@@USER@@"

Add additional arguments to the hhvm service start up that you can’t put in CONFIG_FILE for some reason.

Default: “”

Examples:

“-vLog.Level=Debug” Enable debug log level

“-vServer.DefaultDocument=app.php” Change the default document

#ADDITIONAL_ARGS=""

PID file location.

Default: “/var/run/hhvm/pid”

#PIDFILE="/var/run/hhvm/pid"

/etc/hhvm/server_www_domain.ini: ; php options pid = /var/run/hhvm/pid_www_domain ; hhvm specific hhvm.server.port = 9001 hhvm.server.type = fastcgi hhvm.server.default_document = index.php hhvm.log.use_log_file = true hhvm.log.file = /var/log/hhvm/error_www_domain.log hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc

sudo update-rc.d hhvm_www_domain defaults sudo service hhvm_www_domain start sudo service nginx reload

This should do the trick to use hhvm and php-fpm under a normal linux user with easyengine setup vhosts :slight_smile:

Rahul could you add this to easyengine, i have read that someone wrote a command line example like: ee site create user domain.tld. That would be nice


#2