Skip to content

Commit

Permalink
Add test vhosts and Travis CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoColomb committed Feb 11, 2019
1 parent 283b292 commit 52e1353
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@

.travis.yml export-ignore
/.git* export-ignore
/test export-ignore
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
/conf.d/*.conf
!/conf.d/.default.conf
!/conf.d/no-ssl.default.conf
/test/*
!/test/vhosts/
/k6/
42 changes: 42 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# https://docs.travis-ci.com/

services:
- docker

addons:
hosts:
- server.localhost
- www-server.localhost
- www.server.localhost
- secure.server.localhost
- www.secure.server.localhost
apt:
packages:
- docker-ce

install:
- curl -sSL https://github.com/loadimpact/k6/releases/download/v0.23.1/k6-v0.23.1-linux64.tar.gz | tar -xz
- mv k6-v0.23.1-linux64 k6
- curl -sSL https://github.com/h5bp/server-configs-test/releases/download/0.0.4/server-configs-test.tar.gz | tar -xz -C test/

before_script:
- docker pull nginx
- |
docker run -d -p 80:80 -p 443:443 --name server \
-v $TRAVIS_BUILD_DIR/test/fixtures:/var/www/server.localhost \
-v $TRAVIS_BUILD_DIR/test/vhosts:/etc/nginx/conf.d \
-v $TRAVIS_BUILD_DIR/test/certs:/etc/nginx/certs \
-v $TRAVIS_BUILD_DIR/h5bp:/etc/nginx/h5bp \
-v $TRAVIS_BUILD_DIR/nginx.conf:/etc/nginx/nginx.conf \
-v $TRAVIS_BUILD_DIR/mime.types:/etc/nginx/mime.types \
nginx
script:
- ./k6/k6 run test/lib/index.js
- ./k6/k6 run test/lib/precompressed-files-gzip.js

after_success: ./k6/k6 run test/lib/benchmark.js

after_failure:
- docker ps -a
- docker logs server
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# [Nginx Server Configs](https://github.com/h5bp/server-configs-nginx)

[![Build Status](https://img.shields.io/travis/h5bp/server-configs-nginx/master.svg)](https://travis-ci.org/h5bp/server-configs-nginx)

**Nginx Server Configs** is a collection of configuration snippets that can help
your server improve the web site's performance and security, while also
ensuring that resources are served with the correct content-type and are
Expand Down
22 changes: 22 additions & 0 deletions test/vhosts/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {
listen [::]:80 default_server deferred;
listen 80 default_server deferred;

server_name _;

return 301 https://$host$request_uri;
}


server {
listen [::]:443 ssl default_server;
listen 443 ssl default_server;

server_name _;

include h5bp/ssl/ssl_engine.conf;
include h5bp/ssl/certificate_files.conf;
include h5bp/ssl/policy_intermediate.conf;

return 444;
}
30 changes: 30 additions & 0 deletions test/vhosts/secure.server.localhost.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;

server_name www.secure.server.localhost;

include h5bp/ssl/ssl_engine.conf;
include h5bp/ssl/certificate_files.conf;
include h5bp/ssl/policy_intermediate.conf;

return 301 $scheme://secure.server.localhost$request_uri;
}

server {
listen [::]:443 ssl http2;
listen 443 ssl http2;

server_name secure.server.localhost;

include h5bp/ssl/ssl_engine.conf;
include h5bp/ssl/certificate_files.conf;
include h5bp/ssl/policy_intermediate.conf;

root /var/www/server.localhost;

include h5bp/basic.conf;
include h5bp/errors/custom_errors.conf;

include h5bp/security/strict-transport-security.conf;
}
28 changes: 28 additions & 0 deletions test/vhosts/server.localhost.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
server {
listen [::]:80;
listen 80;

server_name www.server.localhost;

return 301 $scheme://server.localhost$request_uri;
}

server {
listen [::]:80;
listen 80;

server_name server.localhost;

root /var/www/server.localhost;

include h5bp/basic.conf;

gzip_min_length 1;

include h5bp/location/web_performance_filename-based_cache_busting.conf;
include h5bp/errors/custom_errors.conf;

location ~* /test-pre-gzip {
gzip_static on;
}
}
8 changes: 8 additions & 0 deletions test/vhosts/www-server.localhost.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server {
listen [::]:80;
listen 80;

server_name www-server.localhost;

return 301 $scheme://www.www-server.localhost$request_uri;
}

0 comments on commit 52e1353

Please sign in to comment.