Last active
November 24, 2017 13:32
-
-
Save niels-nijens/548e0c4fe80c3c79ca30 to your computer and use it in GitHub Desktop.
Running Apache2 and PHP-FPM in Travis CI container-based infrastructure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addons: | |
apt: | |
packages: | |
- apache2 | |
- libapache2-mod-fastcgi | |
install: | |
- echo "Initializing Apache2 and PHP-FPM" | |
- cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf | |
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm | |
- tests/Resources/apache2/apache2.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
export APACHE_RUN_USER=travis | |
export APACHE_RUN_GROUP=travis | |
export APACHE_PID_FILE=$TRAVIS_BUILD_DIR/tests/Resources/apache2/apache2.pid | |
export APACHE_LOCK_DIR=$TRAVIS_BUILD_DIR/tests/Resources/apache2 | |
export APACHE_LOG_DIR=$TRAVIS_BUILD_DIR/tests/Resources/apache2 | |
exec /usr/sbin/apache2 -f $TRAVIS_BUILD_DIR/tests/Resources/apache2/configuration -k start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Listen 8080 | |
ServerName localhost | |
PidFile ${APACHE_PID_FILE} | |
User ${APACHE_RUN_USER} | |
Group ${APACHE_RUN_GROUP} | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
Include /etc/apache2/mods-available/actions.load | |
Include /etc/apache2/mods-available/alias.load | |
Include /etc/apache2/mods-available/authz_host.load | |
Include /etc/apache2/mods-available/env.load | |
Include /etc/apache2/mods-available/fastcgi.load | |
Include /etc/apache2/mods-available/mime.load | |
Include /etc/apache2/mods-available/rewrite.load | |
Include /etc/apache2/mods-available/setenvif.load | |
Include /etc/apache2/mods-available/actions.conf | |
Include /etc/apache2/mods-available/alias.conf | |
Include /etc/apache2/mods-available/mime.conf | |
Include /etc/apache2/mods-available/setenvif.conf | |
<IfModule mod_fastcgi.c> | |
FastCgiIpcDir ${TRAVIS_BUILD_DIR}/tests/Resources/apache2 | |
</IfModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:8080> | |
DocumentRoot ${TRAVIS_BUILD_DIR}/web | |
<Directory "${TRAVIS_BUILD_DIR}/web"> | |
Options FollowSymLinks MultiViews ExecCGI | |
AllowOverride All | |
Order deny,allow | |
Allow from all | |
</Directory> | |
# Configure 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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks ! 👍