Add test vhosts and Travis CI config

This commit is contained in:
Léo Colombaro 2019-02-10 22:15:33 +01:00
parent 283b292c5e
commit 52e13535b4
8 changed files with 136 additions and 0 deletions

1
.gitattributes vendored
View File

@ -16,3 +16,4 @@
.travis.yml export-ignore .travis.yml export-ignore
/.git* export-ignore /.git* export-ignore
/test export-ignore

3
.gitignore vendored
View File

@ -2,3 +2,6 @@
/conf.d/*.conf /conf.d/*.conf
!/conf.d/.default.conf !/conf.d/.default.conf
!/conf.d/no-ssl.default.conf !/conf.d/no-ssl.default.conf
/test/*
!/test/vhosts/
/k6/

42
.travis.yml Normal file
View File

@ -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

View File

@ -1,5 +1,7 @@
# [Nginx Server Configs](https://github.com/h5bp/server-configs-nginx) # [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 **Nginx Server Configs** is a collection of configuration snippets that can help
your server improve the web site's performance and security, while also your server improve the web site's performance and security, while also
ensuring that resources are served with the correct content-type and are ensuring that resources are served with the correct content-type and are

22
test/vhosts/default.conf Normal file
View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -0,0 +1,8 @@
server {
listen [::]:80;
listen 80;
server_name www-server.localhost;
return 301 $scheme://www.www-server.localhost$request_uri;
}