Apache: Difference between revisions

From Q
Jump to navigation Jump to search
Tgurr (talk | contribs)
No edit summary
Tgurr (talk | contribs)
No edit summary
Line 9: Line 9:
-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 SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5"
+APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D LANGUAGE -D PHP5"
+APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D LANGUAGE -D PHP5"
</pre>
}}
== PHP Support ==
via [PHP-FPM]
{{File|/etc/conf.d/apache2|
<pre>
APACHE2_OPTS="[...] -D PROXY -D FCGID"
</pre>
}}
{{File|/etc/apache2/vhosts.d/subdomain.example.com.conf|
<pre>
    [...]
    </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
    [...]
</pre>
</pre>
}}
}}

Revision as of 17:02, 21 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 -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
    [...]