installation serveur : apache SUEXEC

27/07/2017
apt-get install apache2-suexec-custom libapache2-mod-fcgid php5-cgi
a2enmod fcgid
a2enmod suexec
a2enmod alias
a2enmod actions
a2enmod rewrite
a2enmod authz_groupfile
a2dismod php5

emacs /etc/apache2/apache2.conf

replacer <Directory /var/www/> par <Directory /home/> et mettre AllowOverride All

emacs /etc/apache2/suexec/www-data and set : /home site

emacs /etc/apache2/conf-available/php5-fcgid.conf
AddType application/x-httpd-php .php
AddHandler php-fcgi .php
Action php-fcgi /fcgi-bin/php5-fcgi
Alias /fcgi-bin/ /home/www-data/

        SetHandler fcgid-script
        Options +ExecCGI

FcgidMaxRequestLen 700000000 # for long uploads
FcgidBusyTimeout 36000 # for long downloads
FcgidIOTimeout 600 # blablabla

a2enconf php5-fcgid

mkdir /home/www-data
emacs /home/www-data/php5-fcgi
#!/bin/sh
exec /usr/bin/php5-cgi

chmod +x /home/www-data/php5-fcgi
chown -R www-data:www-data /home/www-data

vhost default:
<VirtualHost *:80>
DocumentRoot /home/www-data/site

FcgidIOTimeout

INSTALLER UN NOUVEAU SITE AVEC SUEXEC

useradd --home=/home/example example -m -U -s /bin/bash
mkdir /home/www-data/example/
cp /home/www-data/php5-fcgi /home/www-data/example/php5-fcgi
chown -R example:example /home/www-data/example
chown -R example:example /home/example

ajouter un vhost


        ServerName example.com

    Alias /fcgi-bin/ /home/www-data/example/
    SuexecUserGroup example example
    DocumentRoot /home/example/site/

Tester le script :

emacs /home/example/site/index.php

=> doit renvoyer example

Raccourcis