add apache setup on travis
authorgggeek <giunta.gaetano@gmail.com>
Fri, 30 Jun 2017 23:10:58 +0000 (00:10 +0100)
committergggeek <giunta.gaetano@gmail.com>
Fri, 30 Jun 2017 23:10:58 +0000 (00:10 +0100)
test/ci/travis/apache_vhost [new file with mode: 0644]
test/ci/travis/apache_vhost_hhvm [new file with mode: 0644]
test/ci/travis/privoxy [new file with mode: 0644]
test/ci/travis/setup_apache.sh [new file with mode: 0755]
test/ci/travis/setup_apache_hhvm.sh [new file with mode: 0755]
test/ci/travis/setup_hhvm.sh [new file with mode: 0755]
test/ci/travis/setup_php_fpm.sh [new file with mode: 0755]
test/ci/travis/setup_privoxy.sh [new file with mode: 0755]

diff --git a/test/ci/travis/apache_vhost b/test/ci/travis/apache_vhost
new file mode 100644 (file)
index 0000000..87841d6
--- /dev/null
@@ -0,0 +1,68 @@
+# Configuration file for Apache running on Travis.
+# PHP setup in FCGI mode
+
+<VirtualHost *:80>
+
+  DocumentRoot %TRAVIS_BUILD_DIR%
+
+  ErrorLog "%TRAVIS_BUILD_DIR%/apache_error.log"
+  CustomLog "%TRAVIS_BUILD_DIR%/apache_access.log" combined
+
+  <Directory "%TRAVIS_BUILD_DIR%">
+    Options FollowSymLinks MultiViews ExecCGI
+    AllowOverride All
+    Order deny,allow
+    Allow from all
+  </Directory>
+
+  # Wire up Apache to use Travis CI's php-fpm.
+  <IfModule mod_fastcgi.c>
+    AddHandler php5-fcgi .php
+    Action php5-fcgi /php5-fcgi
+    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
+    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
+  </IfModule>
+
+</VirtualHost>
+
+<IfModule mod_ssl.c>
+
+<VirtualHost _default_:443>
+
+  DocumentRoot %TRAVIS_BUILD_DIR%
+
+  ErrorLog "%TRAVIS_BUILD_DIR%/apache_error.log"
+  CustomLog "%TRAVIS_BUILD_DIR%/apache_access.log" combined
+
+  <Directory "%TRAVIS_BUILD_DIR%">
+    Options FollowSymLinks MultiViews ExecCGI
+    AllowOverride All
+    Order deny,allow
+    Allow from all
+  </Directory>
+
+  # Wire up Apache to use Travis CI's php-fpm.
+  <IfModule mod_fastcgi.c>
+    AddHandler php5-fcgi .php
+    Action php5-fcgi /php5-fcgi
+    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
+    #FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
+  </IfModule>
+
+  SSLEngine on
+  # This cert is bundled by default in Ubuntu
+  SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
+  SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
+
+  <FilesMatch "\.(cgi|shtml|phtml|php)$">
+    SSLOptions +StdEnvVars
+  </FilesMatch>
+
+  BrowserMatch "MSIE [2-6]" \
+  nokeepalive ssl-unclean-shutdown \
+  downgrade-1.0 force-response-1.0
+  BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
+
+</VirtualHost>
+
+</IfModule>
diff --git a/test/ci/travis/apache_vhost_hhvm b/test/ci/travis/apache_vhost_hhvm
new file mode 100644 (file)
index 0000000..63e57da
--- /dev/null
@@ -0,0 +1,74 @@
+# Configuration file for Apache running on Travis.
+# HHVM setup in FCGI mode
+
+<VirtualHost *:80>
+
+  DocumentRoot %TRAVIS_BUILD_DIR%
+
+  ErrorLog "%TRAVIS_BUILD_DIR%/apache_error.log"
+  CustomLog "%TRAVIS_BUILD_DIR%/apache_access.log" combined
+
+  <Directory "%TRAVIS_BUILD_DIR%">
+    Options FollowSymLinks MultiViews ExecCGI
+    AllowOverride All
+    Order deny,allow
+    Allow from all
+  </Directory>
+
+  # Configure Apache for HHVM FastCGI.
+  # See https://github.com/facebook/hhvm/wiki/fastcgi
+  <IfModule mod_fastcgi.c>
+    <FilesMatch \.php$>
+      SetHandler hhvm-php-extension
+    </FilesMatch>
+    Alias /hhvm /hhvm
+    Action hhvm-php-extension /hhvm virtual
+    FastCgiExternalServer /hhvm -host 127.0.0.1:9000 -pass-header Authorization -idle-timeout 300
+  </IfModule>
+
+</VirtualHost>
+
+<IfModule mod_ssl.c>
+
+<VirtualHost _default_:443>
+
+  DocumentRoot %TRAVIS_BUILD_DIR%
+
+  ErrorLog "%TRAVIS_BUILD_DIR%/apache_error.log"
+  CustomLog "%TRAVIS_BUILD_DIR%/apache_access.log" combined
+
+  <Directory "%TRAVIS_BUILD_DIR%">
+    Options FollowSymLinks MultiViews ExecCGI
+    AllowOverride All
+    Order deny,allow
+    Allow from all
+  </Directory>
+
+  # Configure Apache for HHVM FastCGI.
+  # See https://github.com/facebook/hhvm/wiki/fastcgi
+  <IfModule mod_fastcgi.c>
+    <FilesMatch \.php$>
+      SetHandler hhvm-php-extension
+    </FilesMatch>
+    Alias /hhvm /hhvm
+    Action hhvm-php-extension /hhvm virtual
+    #FastCgiExternalServer /hhvm -host 127.0.0.1:9000 -pass-header Authorization -idle-timeout 300
+  </IfModule>
+
+  SSLEngine on
+  # This cert is bundled by default in Ubuntu
+  SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
+  SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
+
+  <FilesMatch "\.(cgi|shtml|phtml|php)$">
+    SSLOptions +StdEnvVars
+  </FilesMatch>
+
+  BrowserMatch "MSIE [2-6]" \
+  nokeepalive ssl-unclean-shutdown \
+  downgrade-1.0 force-response-1.0
+  BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
+
+</VirtualHost>
+
+</IfModule>
diff --git a/test/ci/travis/privoxy b/test/ci/travis/privoxy
new file mode 100644 (file)
index 0000000..67d8ff8
--- /dev/null
@@ -0,0 +1 @@
+listen-address 127.0.0.1:8080
diff --git a/test/ci/travis/setup_apache.sh b/test/ci/travis/setup_apache.sh
new file mode 100755 (executable)
index 0000000..a39d676
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# set up Apache for php-fpm
+# @see https://github.com/travis-ci/travis-ci.github.com/blob/master/docs/user/languages/php.md#apache--php
+
+sudo a2enmod rewrite actions fastcgi alias ssl
+
+# configure apache virtual hosts
+sudo cp -f tests/ci/travis/apache_vhost /etc/apache2/sites-available/default
+sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default
+sudo service apache2 restart
diff --git a/test/ci/travis/setup_apache_hhvm.sh b/test/ci/travis/setup_apache_hhvm.sh
new file mode 100755 (executable)
index 0000000..a72941d
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# set up Apache for hhvm-fcgi
+# @see https://github.com/travis-ci/travis-ci.github.com/blob/master/docs/user/languages/php.md#apache--php
+
+sudo a2enmod rewrite actions fastcgi alias ssl
+
+# configure apache virtual hosts
+sudo cp -f tests/ci/travis/apache_vhost_hhvm /etc/apache2/sites-available/default
+sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default
+sudo service apache2 restart
diff --git a/test/ci/travis/setup_hhvm.sh b/test/ci/travis/setup_hhvm.sh
new file mode 100755 (executable)
index 0000000..289e750
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# start HHVM
+hhvm -m daemon -vServer.Type=fastcgi -vServer.Port=9000 -vServer.FixPathInfo=true
diff --git a/test/ci/travis/setup_php_fpm.sh b/test/ci/travis/setup_php_fpm.sh
new file mode 100755 (executable)
index 0000000..7788fdc
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# enable php-fpm
+sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
+# work around travis issue #3385
+if [ "$TRAVIS_PHP_VERSION" = "7.0" -a -n "$(ls -A ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d)" ]; then
+  sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
+fi
+echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
+echo "always_populate_raw_post_data = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
+~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
diff --git a/test/ci/travis/setup_privoxy.sh b/test/ci/travis/setup_privoxy.sh
new file mode 100755 (executable)
index 0000000..12e0e61
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# configure privoxy
+
+sudo cp -f tests/ci/travis/privoxy /etc/privoxy/config
+sudo service privoxy restart