Skip to content

Commit c28cef8

Browse files
committed
update Dockerfile and sample nginx.conf
Signed-off-by: Liu Lantao <[email protected]>
1 parent a622bc4 commit c28cef8

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
FROM centos as builder
22

3-
ADD http://mirrors.aliyun.com/repo/Centos-7.repo /etc/yum.repos.d/CentOS-Base.repo
43
RUN yum install gcc make pcre-devel zlib-devel openssl-devel -y \
54
&& yum clean all
65

@@ -21,8 +20,8 @@ WORKDIR ${NGX_SRC_DIR}
2120
ADD . nginx-http-accounting-module
2221
RUN ./configure --prefix=${PREFIX} \
2322
--with-stream \
24-
--add-module=nginx-http-accounting-module \
25-
--add-module=echo-nginx-module-master \
23+
--add-dynamic-module=nginx-http-accounting-module \
24+
--add-dynamic-module=echo-nginx-module-master \
2625
--http-log-path=/dev/stdout \
2726
--error-log-path=/dev/stderr \
2827
&& make -s && make -s install
@@ -42,8 +41,9 @@ RUN ln -sf /dev/stdout ${PREFIX}/logs/access.log \
4241
&& ln -sf /dev/stderr ${PREFIX}/logs/error.log \
4342
&& ln -sf ../usr/share/zoneinfo/Asia/Shanghai /etc/localtime
4443

45-
ADD misc/nginx.conf ${PREFIX}/conf/nginx.conf
44+
ADD samples/nginx.conf ${PREFIX}/conf/nginx.conf
4645

47-
EXPOSE 80
46+
EXPOSE 8080
47+
EXPOSE 8888
4848
STOPSIGNAL SIGTERM
4949
ENTRYPOINT ["./sbin/nginx", "-g", "daemon off;"]

misc/nginx.conf renamed to samples/nginx.conf

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
load_module modules/ngx_http_accounting_module.so;
2+
load_module modules/ngx_http_echo_module.so;
3+
14
worker_processes auto;
25
error_log logs/error.log notice;
36

@@ -9,12 +12,8 @@ http {
912
include mime.types;
1013
default_type application/octet-stream;
1114

12-
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
13-
# '$status $body_bytes_sent "$http_referer" '
14-
# '"$http_user_agent" "$http_x_forwarded_for"';
15-
16-
#access_log logs/access.log main;
1715
access_log off;
16+
log_not_found off;
1817

1918
sendfile on;
2019
#tcp_nopush on;
@@ -25,16 +24,15 @@ http {
2524
#gzip on;
2625

2726
http_accounting on;
28-
http_accounting_interval 10;
27+
http_accounting_interval 60;
2928
http_accounting_perturb on;
30-
http_accounting_id '_NGXTA_';
29+
http_accounting_id 'HTTP';
3130
http_accounting_log logs/http-accounting.log;
3231

33-
log_not_found off;
34-
3532
server {
36-
listen 1234;
33+
listen 8888;
3734
server_name echo;
35+
http_accounting_id $host;
3836

3937
location / {
4038
echo hello;
@@ -49,20 +47,36 @@ http {
4947
echo nginx;
5048
echo_flush;
5149

52-
http_accounting_id '_HTTP_ECHO_';
50+
http_accounting_id 'HTTP_ECHO';
51+
}
52+
53+
location /echo/now {
54+
echo "Hello world!";
5355
}
5456
}
5557

5658
server {
57-
listen 80;
59+
listen 8080;
5860
server_name localhost;
5961

6062
#charset koi8-r;
6163

6264
location / {
63-
root html;
65+
return 200 '';
66+
http_accounting_id $uri;
67+
}
68+
69+
location /index {
70+
alias html;
6471
index index.html index.htm;
65-
http_accounting_id $host;
72+
http_accounting_id "INDEX";
73+
}
74+
75+
location /echo {
76+
proxy_pass http://localhost:8888;
77+
proxy_set_header Host "echo";
78+
proxy_buffering off;
79+
http_accounting_id "HTTP_PROXY_ECHO";
6680
}
6781

6882
#error_page 404 /404.html;

0 commit comments

Comments
 (0)