Apache

Installer Apache

# cd /usr/ports/www/apache22
# make config
postfix
Verifier que les options suivantes soient sélectionnées : SSL 
# make install clean && rehash
La version d'Apache presentée n'est plus d'actualité, on active le service.
# echo "DEFAULT_VERSIONS+=apache=2.2" >> /etc/make.conf
# echo 'apache22_enable="YES"' >> /etc/rc.conf

Installer le module php

# cd /usr/ports/www/mod_php56
# make install clean && rehash

Lier l'extension php au module PHP pour que le serveur Apache interprète les scripts

/usr/local/etc/apache22/Includes/php.conf
<FilesMatch "\.php$"> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch>

Activation de php dans le serveur

/usr/local/etc/apache22/httpd.conf
<IfModule dir_module> <IfModule php5_module> DirectoryIndex index.php index.html index.htm </IfModule> <IfModule !php5_module> DirectoryIndex index.html index.htm </IfModule> </IfModule>

Installer les extensions php

# cd /usr/ports/lang/php56-extensions/
Sélectionner les cases (ad hoc)
Exemple de liste un peu exhaustive
php56-5.6.24_1                 PHP Scripting Language
php56-bcmath-5.6.24_1          The bcmath shared extension for php
php56-bz2-5.6.24_1             The bz2 shared extension for php
php56-ctype-5.6.24_1           The ctype shared extension for php
php56-curl-5.6.24_1            The curl shared extension for php
php56-dom-5.6.24_1             The dom shared extension for php
php56-exif-5.6.24_1            The exif shared extension for php
php56-extensions-1.0           "meta-port" to install PHP extensions
php56-fileinfo-5.6.24_1        The fileinfo shared extension for php
php56-filter-5.6.24_1          The filter shared extension for php
php56-ftp-5.6.24_1             The ftp shared extension for php
php56-gd-5.6.24_1              The gd shared extension for php
php56-gettext-5.6.24_1         The gettext shared extension for php
php56-hash-5.6.24_1            The hash shared extension for php
php56-iconv-5.6.24_1           The iconv shared extension for php
php56-imap-5.6.24_1            The imap shared extension for php
php56-json-5.6.24_1            The json shared extension for php
php56-ldap-5.6.24_1            The ldap shared extension for php
php56-mbstring-5.6.24_1        The mbstring shared extension for php
php56-mcrypt-5.6.24_1          The mcrypt shared extension for php
php56-mysql-5.6.24_1           The mysql shared extension for php
php56-mysqli-5.6.24_1          The mysqli shared extension for php
php56-opcache-5.6.24_2         The opcache shared extension for php
php56-openssl-5.6.24_1         The openssl shared extension for php
php56-pdo-5.6.24_1             The pdo shared extension for php
php56-pdo_mysql-5.6.24_1       The pdo_mysql shared extension for php
php56-pdo_sqlite-5.6.24_1      The pdo_sqlite shared extension for php
php56-phar-5.6.24_1            The phar shared extension for php
php56-posix-5.6.24_1           The posix shared extension for php
php56-pspell-5.6.24_2          The pspell shared extension for php
php56-readline-5.6.24_1        The readline shared extension for php
php56-session-5.6.24_2         The session shared extension for php
php56-simplexml-5.6.24_1       The simplexml shared extension for php
php56-sockets-5.6.24_1         The sockets shared extension for php
php56-sqlite3-5.6.24_1         The sqlite3 shared extension for php
php56-tidy-5.6.24_1            The tidy shared extension for php
php56-tokenizer-5.6.24_1       The tokenizer shared extension for php
php56-xml-5.6.24_1             The xml shared extension for php
php56-xmlreader-5.6.24_1       The xmlreader shared extension for php
php56-xmlrpc-5.6.24_1          The xmlrpc shared extension for php
php56-xmlwriter-5.6.24_1       The xmlwriter shared extension for php
php56-zip-5.6.24_1             The zip shared extension for php
php56-zlib-5.6.24_1            The zlib shared extension for php

# make install clean && rehash

Copie et édition du fichier de configuration de php (suivant les besoins ):

# cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
/usr/local/etc/php.ini
short_open_tag = On output_buffering = Off max_execution_time = 240 max_input_time = 300 ;error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT post_max_size = 24M include path=".:/usr/local/share/pear" upload_max_filesize = 24M date.timezone = "Europe/Paris"

Rotation des logs du serveur. ajouter au fichier suivant :

/etc/newsyslog.conf
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] /var/log/apache/httpd-access.log 644 7 * @T23 JC /var/run/httpd.pid /var/log/apache/httpd-error.log 644 7 * @T23 JC /var/run/httpd.pid /var/log/nginx-access.log 644 7 * $D01 JC /var/run/nginx.pid 30 ## le code pour le signal SIGUSR1

configuration des hosts TODO