no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | apache_worker_mpm_php_cgi_suexec_setup [2015/06/01 21:41] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Apache Worker MPM PHP CGI Suexec Setup ====== | ||
| + | Components to an Apache + SuExec + FCGI + PHP setup: | ||
| + | |||
| + | First, need some variables to stay the same throughout the setup. | ||
| + | |||
| + | User Apache runs as: daemon | ||
| + | User CGI programs run as: steve | ||
| + | Parent directory location of CGI binaries, web documents | ||
| + | |||
| + | 1. Apache must be configured with specific SuExec command line arguments. | ||
| + | |||
| + | For an OS X user development system, these would be passed to Apache' | ||
| + | |||
| + | < | ||
| + | --enable-suexec \ | ||
| + | --with-suexec-docroot=/ | ||
| + | --with-suexec-bin=/ | ||
| + | --with-suexec-caller=daemon \ | ||
| + | --with-suexec-uidmin=500 \ | ||
| + | --with-suexec-logfile=/ | ||
| + | --with-suexec-gidmin=20 \ | ||
| + | --with-suexec-userdir=Sites \ | ||
| + | </ | ||
| + | |||
| + | 2. Build mod_fcgid against Apache | ||
| + | |||
| + | < | ||
| + | ./ | ||
| + | </ | ||
| + | |||
| + | make install should edit httpd.conf so that it loads the module, but if not, add it in there: | ||
| + | |||
| + | < | ||
| + | LoadModule fcgid_module modules/ | ||
| + | </ | ||
| + | |||
| + | 3. Build PHP as normal, install as a CGI binary | ||
| + | |||
| + | 4. Create a PHP-wrapper script. | ||
| + | |||
| + | < | ||
| + | # mkdir / | ||
| + | # chown -R steve: | ||
| + | </ | ||
| + | |||
| + | http:// | ||
| + | |||
| + | 5. Add parts to Apache configuration | ||
| + | |||
| + | load fcgid module globally (httpd.conf): | ||
| + | |||
| + | < | ||
| + | LoadModule fcgid_module modules/ | ||
| + | </ | ||
| + | |||
| + | Setup the fcgi-bin directory to contain handlers and allow executable CGI files (httpd.conf): | ||
| + | |||
| + | < | ||
| + | < | ||
| + | SetHandler fcgid-script | ||
| + | Options +ExecCGI | ||
| + | Order allow,deny | ||
| + | Allow from all | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Setup PHP handler extension globally (httpd.conf): | ||
| + | |||
| + | < | ||
| + | AddHandler fcgid-script .php | ||
| + | FcgidWrapper / | ||
| + | </ | ||
| + | |||
| + | Turn on SuExec globally (httpd.conf): | ||
| + | |||
| + | < | ||
| + | SuexecUserGroup steve staff | ||
| + | </ | ||
| + | |||
| + | Add a VirtualHost directive that is under the compiled docroot for SuExec: | ||
| + | |||
| + | < | ||
| + | < | ||
| + | ServerName qa.steve.beandog.org | ||
| + | DocumentRoot "/ | ||
| + | </ | ||
| + | </ | ||