Apache: Difference between revisions

From Q
Jump to navigation Jump to search
Tgurr (talk | contribs)
Tgurr (talk | contribs)
No edit summary
Line 27: Line 27:
     </Directory>
     </Directory>


     <FilesMatch "\.php$">
    # PHP-FPM
     <FilesMatch "\.(php|php5|phtml)$">
         SetHandler "proxy:unix:/var/run/php-fpm-www.sock|fcgi://localhost"
         SetHandler "proxy:unix:/var/run/php-fpm-www.sock|fcgi://localhost"
     </FilesMatch>
     </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
     SSLEngine On

Revision as of 02:04, 23 April 2016

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"
+APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D LANGUAGE"

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>

    # PHP-FPM
    <FilesMatch "\.(php|php5|phtml)$">
        SetHandler "proxy:unix:/var/run/php-fpm-www.sock|fcgi://localhost"
    </FilesMatch>

    SSLEngine On
    [...]