Setup XAMPP with http2/SSL on localhost Sep 21, 2016

Download latest version at https://www.apachefriends.org/download.html

XAMPP

I recommend to install XAMPP into the special folder in root directory like in D:\xampp

Configuration

Note: This is my own settings, recommend for PHP Yii Framework v2.0 .

1. MySQL

edit xampp\mysql\bin\my.ini

Add the following lines below [mysqld]

default-storage-engine=innodb
character-set-server=utf8

Change max_allowed_packet to 10M and innodb_log_file_size to 50M like below:

max_allowed_packet = 10M
innodb_log_file_size = 50M

2. Apache

Assume that we put our projects in D:\Projects, so we add that directory in httpd.conf, open xampp\apache\conf\httpd.conf and add the following:

<Directory "D:/Projects">
     Options Indexes FollowSymLinks Includes ExecCGI
     AllowOverride All
     Order allow,deny
     Allow from all
</Directory>

Then edit the block <Directory /> like below

<Directory />
     AllowOverride all
     Require all granted
</Directory>

3. PHP.ini

We also make some changes to the php.ini file:

Uncomment those lines:

extension=php_openssl.dll
extension=php_intl.dll

Change some values:

expose_php = Off
upload_max_filesize = 20M
post_max_size = 80M
memory_limit=256M
max_execution_time=300
max_input_time=600

add this line before Dynamic Extensions:

openssl.cafile="\xampp\perl\vendor\lib\Mozilla\CA\cacert.pem";

4. VirtualHost

Open xampp\apache\conf\extra\httpd-vhosts.conf and add the following:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot "D:/xampp/htdocs"
     ServerName localhost
</VirtualHost>

You can add more VirtualHost for your projects

5. http2

Open xampp\apache\conf\httpd.conf

Uncomment:

LoadModule http2_module modules/mod_http2.so

add:

Protocols h2 h2c http/1.1

Open xampp\apache\conf\extra\httpd-ssl.conf

Edit SSLCipherSuite like below

SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256

MISC

For Long name display, we add .htaccess in htdocs, the .htaccess's content:

Options +Indexes
IndexOptions FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=*

Make phpMyAdmin expiration time longer, add this line to xampp\phpMyAdmin\config.inc.php

$cfg['Servers'][$i]['LoginCookieValidity'] = 360000;

PATH Environment Variable in Windows:

D:\xampp\php
D:\xampp\mysql\bin

Note: if you want to update your xampp to the latest version, follow this article.

Advertisement

Latest Updates