Apache

From Q
Revision as of 17:02, 21 April 2016 by Tgurr (talk | contribs)
Jump to navigation Jump to search

This Apache setup explains how to configure Apache 2.4 with the mpm-itk worker so we can have different users for our virtual hosts. Further we want to have a few SSL based virtual hosts on one IP for which we NEED a wildcard certificate if we want to support legacy operating system clients (Windows XP) which don't support SNI and some other SSL sites on different IP adresses, each with their own virtualhost and certificate.

Virtual hosting - HTTP

Virtual hosting - SSL/SNI

First we disable the SSL_DEFAULT_VHOST if it's enabled by removing -D SSL_DEFAULT_VHOST from /etc/conf.d/apache2.

File: /etc/conf.d/apache2
-APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5"
+APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D LANGUAGE -D PHP5"

PHP Support

via [PHP-FPM]

File: /etc/conf.d/apache2
APACHE2_OPTS="[...] -D PROXY -D FCGID"
File: /etc/apache2/vhosts.d/subdomain.example.com.conf
    [...]
    </Directory>

    <FilesMatch "\.php$">
        SetHandler "proxy:unix:/var/run/php-fpm-www.sock|fcgi://localhost"
    </FilesMatch>

    # Set it to handle the files
    <IfModule mod_mime.c>
        AddHandler application/x-httpd-php .php .php5 .phtml
        AddHandler application/x-httpd-php-source .phps
    </IfModule>

    DirectoryIndex index.php index.phtml

    SSLEngine On
    [...]