Skip to content

Commit

Permalink
update Dockerfile and sample nginx.conf
Browse files Browse the repository at this point in the history
Signed-off-by: Liu Lantao <liulantao@gmail.com>
  • Loading branch information
Lax committed May 11, 2018
1 parent a622bc4 commit c28cef8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 19 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM centos as builder

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

Expand All @@ -21,8 +20,8 @@ WORKDIR ${NGX_SRC_DIR}
ADD . nginx-http-accounting-module
RUN ./configure --prefix=${PREFIX} \
--with-stream \
--add-module=nginx-http-accounting-module \
--add-module=echo-nginx-module-master \
--add-dynamic-module=nginx-http-accounting-module \
--add-dynamic-module=echo-nginx-module-master \
--http-log-path=/dev/stdout \
--error-log-path=/dev/stderr \
&& make -s && make -s install
Expand All @@ -42,8 +41,9 @@ RUN ln -sf /dev/stdout ${PREFIX}/logs/access.log \
&& ln -sf /dev/stderr ${PREFIX}/logs/error.log \
&& ln -sf ../usr/share/zoneinfo/Asia/Shanghai /etc/localtime

ADD misc/nginx.conf ${PREFIX}/conf/nginx.conf
ADD samples/nginx.conf ${PREFIX}/conf/nginx.conf

EXPOSE 80
EXPOSE 8080
EXPOSE 8888
STOPSIGNAL SIGTERM
ENTRYPOINT ["./sbin/nginx", "-g", "daemon off;"]
42 changes: 28 additions & 14 deletions misc/nginx.conf → samples/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
load_module modules/ngx_http_accounting_module.so;
load_module modules/ngx_http_echo_module.so;

worker_processes auto;
error_log logs/error.log notice;

Expand All @@ -9,12 +12,8 @@ http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;
access_log off;
log_not_found off;

sendfile on;
#tcp_nopush on;
Expand All @@ -25,16 +24,15 @@ http {
#gzip on;

http_accounting on;
http_accounting_interval 10;
http_accounting_interval 60;
http_accounting_perturb on;
http_accounting_id '_NGXTA_';
http_accounting_id 'HTTP';
http_accounting_log logs/http-accounting.log;

log_not_found off;

server {
listen 1234;
listen 8888;
server_name echo;
http_accounting_id $host;

location / {
echo hello;
Expand All @@ -49,20 +47,36 @@ http {
echo nginx;
echo_flush;

http_accounting_id '_HTTP_ECHO_';
http_accounting_id 'HTTP_ECHO';
}

location /echo/now {
echo "Hello world!";
}
}

server {
listen 80;
listen 8080;
server_name localhost;

#charset koi8-r;

location / {
root html;
return 200 '';
http_accounting_id $uri;
}

location /index {
alias html;
index index.html index.htm;
http_accounting_id $host;
http_accounting_id "INDEX";
}

location /echo {
proxy_pass http://localhost:8888;
proxy_set_header Host "echo";
proxy_buffering off;
http_accounting_id "HTTP_PROXY_ECHO";
}

#error_page 404 /404.html;
Expand Down

0 comments on commit c28cef8

Please sign in to comment.