Try and run the tests on nginx
This commit is contained in:
parent
5f3461daf8
commit
7237d67dda
6 changed files with 173 additions and 2 deletions
19
travis/default-site.tpl.conf
Normal file
19
travis/default-site.tpl.conf
Normal file
|
@ -0,0 +1,19 @@
|
|||
server {
|
||||
listen 8000 default_server;
|
||||
listen [::]:8000 default_server ipv6only=on;
|
||||
|
||||
root {ROOT}/public;
|
||||
|
||||
access_log /tmp/access.log;
|
||||
error_log /tmp/error.log;
|
||||
|
||||
location ~* "\.php(/|$)" {
|
||||
include fastcgi.conf;
|
||||
fastcgi_pass php;
|
||||
}
|
||||
|
||||
location / {
|
||||
# First attempt to serve request as file, then as directory, then fall back to index.php.
|
||||
try_files $uri $uri/ /index.php$is_args$args;
|
||||
}
|
||||
}
|
39
travis/fastcgi.tpl.conf
Normal file
39
travis/fastcgi.tpl.conf
Normal file
|
@ -0,0 +1,39 @@
|
|||
fastcgi_param QUERY_STRING $query_string;
|
||||
fastcgi_param REQUEST_METHOD $request_method;
|
||||
fastcgi_param CONTENT_TYPE $content_type;
|
||||
fastcgi_param CONTENT_LENGTH $content_length;
|
||||
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
fastcgi_param DOCUMENT_URI $document_uri;
|
||||
fastcgi_param DOCUMENT_ROOT $document_root;
|
||||
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
||||
fastcgi_param HTTPS $https if_not_empty;
|
||||
|
||||
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
||||
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
||||
|
||||
fastcgi_param REMOTE_ADDR $remote_addr;
|
||||
fastcgi_param REMOTE_PORT $remote_port;
|
||||
fastcgi_param SERVER_ADDR $server_addr;
|
||||
fastcgi_param SERVER_PORT $server_port;
|
||||
fastcgi_param SERVER_NAME $server_name;
|
||||
|
||||
# PHP only, required if PHP was built with --enable-force-cgi-redirect
|
||||
fastcgi_param REDIRECT_STATUS 200;
|
||||
|
||||
fastcgi_split_path_info ^(.+\.php)(.*)$;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
#fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
|
||||
# fastcgi_intercept_errors on;
|
||||
fastcgi_ignore_client_abort off;
|
||||
fastcgi_connect_timeout 60;
|
||||
fastcgi_send_timeout 1800;
|
||||
fastcgi_read_timeout 1800;
|
||||
fastcgi_buffer_size 128k;
|
||||
fastcgi_buffers 4 256k;
|
||||
fastcgi_busy_buffers_size 256k;
|
||||
fastcgi_temp_file_write_size 256k;
|
||||
fastcgi_keep_conn on;
|
44
travis/install-nginx.sh
Normal file
44
travis/install-nginx.sh
Normal file
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
DIR=$(realpath $(dirname "$0"))
|
||||
USER=$(whoami)
|
||||
PHP_VERSION=$(phpenv version-name)
|
||||
ROOT=$(realpath "$DIR/..")
|
||||
PORT=8000
|
||||
SERVER="/tmp/php.sock"
|
||||
|
||||
function tpl {
|
||||
sed \
|
||||
-e "s|{DIR}|$DIR|g" \
|
||||
-e "s|{USER}|$USER|g" \
|
||||
-e "s|{PHP_VERSION}|$PHP_VERSION|g" \
|
||||
-e "s|{ROOT}|$ROOT|g" \
|
||||
-e "s|{PORT}|$PORT|g" \
|
||||
-e "s|{SERVER}|$SERVER|g" \
|
||||
< $1 > $2
|
||||
}
|
||||
|
||||
# Make some working directories.
|
||||
mkdir "$DIR/nginx"
|
||||
mkdir "$DIR/nginx/sites-enabled"
|
||||
mkdir "$DIR/var"
|
||||
|
||||
PHP_FPM_BIN="$HOME/.phpenv/versions/$PHP_VERSION/sbin/php-fpm"
|
||||
PHP_FPM_CONF="$DIR/nginx/php-fpm.conf"
|
||||
|
||||
# Build the php-fpm.conf.
|
||||
tpl "$DIR/php-fpm.tpl.conf" "$PHP_FPM_CONF"
|
||||
|
||||
# Start php-fpm
|
||||
"$PHP_FPM_BIN" --fpm-config "$PHP_FPM_CONF"
|
||||
|
||||
# Build the default nginx config files.
|
||||
tpl "$DIR/nginx.tpl.conf" "$DIR/nginx/nginx.conf"
|
||||
tpl "$DIR/fastcgi.tpl.conf" "$DIR/nginx/fastcgi.conf"
|
||||
tpl "$DIR/default-site.tpl.conf" "$DIR/nginx/sites-enabled/default-site.conf"
|
||||
|
||||
# Start nginx.
|
||||
nginx -c "$DIR/nginx/nginx.conf"
|
52
travis/nginx.tpl.conf
Normal file
52
travis/nginx.tpl.conf
Normal file
|
@ -0,0 +1,52 @@
|
|||
error_log /tmp/error.log;
|
||||
pid /tmp/nginx.pid;
|
||||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
# Set an array of temp and cache file options that will otherwise default to restricted locations accessible only to root.
|
||||
client_body_temp_path /tmp/client_body;
|
||||
fastcgi_temp_path /tmp/fastcgi_temp;
|
||||
proxy_temp_path /tmp/proxy_temp;
|
||||
scgi_temp_path /tmp/scgi_temp;
|
||||
uwsgi_temp_path /tmp/uwsgi_temp;
|
||||
|
||||
##
|
||||
# Basic Settings
|
||||
##
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
# server_tokens off;
|
||||
# server_names_hash_bucket_size 64;
|
||||
# server_name_in_redirect off;
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
access_log /tmp/access.log;
|
||||
error_log /tmp/error.log;
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
##
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
##
|
||||
# Virtual Host Configs
|
||||
##
|
||||
# include {DIR}/nginx/conf.d/*.conf;
|
||||
include {DIR}/nginx/sites-enabled/*;
|
||||
|
||||
upstream php {
|
||||
server 127.0.0.1:{PORT};
|
||||
}
|
||||
}
|
9
travis/php-fpm.tpl.conf
Normal file
9
travis/php-fpm.tpl.conf
Normal file
|
@ -0,0 +1,9 @@
|
|||
[global]
|
||||
|
||||
[travis]
|
||||
user = {USER}
|
||||
listen = {PORT}
|
||||
listen.mode = 0666
|
||||
pm = static
|
||||
pm.max_children = 5
|
||||
php_admin_value[memory_limit] = 32M
|
Loading…
Add table
Add a link
Reference in a new issue