Skip to content

Commit 29fb6be

Browse files
committed
add test
1 parent f44b475 commit 29fb6be

File tree

3 files changed

+156
-0
lines changed

3 files changed

+156
-0
lines changed

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ RUN apk add --update openssl-dev git curl geoip-dev file wget \
2424
# && wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz && gunzip GeoIP.dat.gz
2525

2626
EXPOSE 8080
27+
WORKDIR /usr/local/nginx
2728
CMD ["/bin/sh"]

docker-compose.test.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: "3.8"
2+
services:
3+
nginx:
4+
build: .
5+
volumes:
6+
- ./test/nginx.conf:/usr/local/nginx/conf/nginx.conf
7+
entrypoint: ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]
8+
sut:
9+
image: amazonlinux:2
10+
command: ["/usr/bin/curl", "-f", "nginx/hello"]
11+
depends_on:
12+
- nginx

test/nginx.conf

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
load_module modules/ngx_http_mruby_module.so;
2+
load_module modules/ngx_pagespeed.so;
3+
4+
# For more information on configuration, see:
5+
# * Official English Documentation: http://nginx.org/en/docs/
6+
# * Official Russian Documentation: http://nginx.org/ru/docs/
7+
8+
user nginx;
9+
worker_processes auto;
10+
11+
error_log /dev/stderr debug;
12+
# error_log /var/log/nginx/error.log;
13+
#error_log /var/log/nginx/error.log notice;
14+
#error_log /var/log/nginx/error.log info;
15+
16+
pid /var/run/nginx.pid;
17+
18+
19+
events {
20+
worker_connections 1024;
21+
}
22+
23+
http {
24+
include /etc/nginx/mime.types;
25+
default_type application/octet-stream;
26+
27+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
28+
'$status $body_bytes_sent "$http_referer" '
29+
'"$http_user_agent" "$http_x_forwarded_for"';
30+
31+
access_log /var/log/nginx/access.log main;
32+
33+
sendfile on;
34+
tcp_nopush on;
35+
tcp_nodelay on;
36+
37+
#keepalive_timeout 0;
38+
keepalive_timeout 65;
39+
types_hash_max_size 2048;
40+
41+
#gzip on;
42+
43+
# Load modular configuration files from the /etc/nginx/conf.d directory.
44+
# See http://nginx.org/en/docs/ngx_core_module.html#include
45+
# for more information.
46+
include /etc/nginx/conf.d/*.conf;
47+
48+
index index.html index.htm;
49+
50+
server {
51+
pagespeed on;
52+
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
53+
pagespeed FileCachePath /var/cache;
54+
55+
listen 80;
56+
server_name localhost;
57+
root /usr/share/nginx/html;
58+
59+
#charset koi8-r;
60+
61+
#access_log /var/log/nginx/host.access.log main;
62+
63+
location / {
64+
}
65+
66+
location /hello {
67+
mruby_content_handler_code '
68+
Nginx.rputs "hello"
69+
Nginx.echo "world!"
70+
';
71+
}
72+
73+
# redirect server error pages to the static page /40x.html
74+
#
75+
error_page 404 /404.html;
76+
location = /40x.html {
77+
}
78+
79+
# redirect server error pages to the static page /50x.html
80+
#
81+
error_page 500 502 503 504 /50x.html;
82+
location = /50x.html {
83+
}
84+
85+
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
86+
#
87+
#location ~ \.php$ {
88+
# proxy_pass http://127.0.0.1;
89+
#}
90+
91+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
92+
#
93+
#location ~ \.php$ {
94+
# root html;
95+
# fastcgi_pass 127.0.0.1:9000;
96+
# fastcgi_index index.php;
97+
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
98+
# include fastcgi_params;
99+
#}
100+
101+
# deny access to .htaccess files, if Apache's document root
102+
# concurs with nginx's one
103+
#
104+
#location ~ /\.ht {
105+
# deny all;
106+
#}
107+
}
108+
109+
110+
# another virtual host using mix of IP-, name-, and port-based configuration
111+
#
112+
#server {
113+
# listen 8000;
114+
# listen somename:8080;
115+
# server_name somename alias another.alias;
116+
# root html;
117+
118+
# location / {
119+
# }
120+
#}
121+
122+
123+
# HTTPS server
124+
#
125+
#server {
126+
# listen 443;
127+
# server_name localhost;
128+
# root html;
129+
130+
# ssl on;
131+
# ssl_certificate cert.pem;
132+
# ssl_certificate_key cert.key;
133+
134+
# ssl_session_timeout 5m;
135+
136+
# ssl_protocols SSLv2 SSLv3 TLSv1;
137+
# ssl_ciphers HIGH:!aNULL:!MD5;
138+
# ssl_prefer_server_ciphers on;
139+
140+
# location / {
141+
# }
142+
#}
143+
}

0 commit comments

Comments
 (0)