Skip to content

Commit

Permalink
feat: 新增 tmp cache, 更改 結構
Browse files Browse the repository at this point in the history
  • Loading branch information
imagine10255 committed Mar 4, 2022
1 parent b3ee704 commit e2022fe
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 37 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ RUN echo "alias ll='ls -alF'" >> ~/.bashrc \
&& echo "alias l='ls -CF'" >> ~/.bashrc

RUN mkdir /tmp/nginx/cache -p

ADD ./config/nginx/nginx.conf /etc/nginx/nginx.conf
ADD ./config/nginx/site-modules /etc/nginx/site-modules
ADD ./config/nginx/conf.d /etc/nginx/conf.d
ADD ./config/nginx /etc/nginx
COPY ./public /etc/nginx/html

WORKDIR /etc/nginx
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ add config to docker-compose.yml

```
volumes:
- "./config/nginx/conf.d:/etc/nginx/conf.d"
- "/home/adminuser/service/ftp-server/data:/etc/nginx/html:ro"
```

```
# options:
- "./config/nginx/nginx.conf:/etc/nginx/nginx.conf"
- "./config/nginx/site-modules:/etc/nginx/site-modules"
- "./config/nginx/conf.d:/etc/nginx/conf.d"
- "./public:/etc/nginx/html"
```

## Reference Architecture:
Expand All @@ -71,7 +75,8 @@ ARG ENABLED_MODULES="ndk headers-more"

run build
```bash
$ docker build . imagine10255/bear-docker-nginx:latest
$ docker build . -t imagine10255/bear-docker-nginx:latest
$ docker push imagine10255/bear-docker-nginx:latest
```

## Ref
Expand Down
34 changes: 5 additions & 29 deletions config/nginx/conf.d/app.conf
Original file line number Diff line number Diff line change
@@ -1,41 +1,17 @@
# resolver
resolver 127.0.0.11 valid=30s;

# module njs
js_import app from app.js;

# module headers-more
# set headers
more_set_headers 'Via-By: BEA118-255';

# clear header
more_clear_headers 'X-AspNet-Version';
more_clear_headers 'X-Powered-By';

# cache
proxy_cache_path /tmp/nginx/cache levels=1:2 keys_zone=bear_cache:10m inactive=1d max_size=10g;


# include sites conf
include conf.d/bearests.com/*.conf;




server {
listen 80 default_server;
listen [::]:80 default_server;
listen 443 default_server ssl;
server_name _;

ssl_certificate conf.d/default/default.crt;
ssl_certificate_key conf.d/default/default.key;

location /hello {
js_content app.hello;
}

location /test.html {
}

location / {
return 444;
}
}


File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions config/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ http {
include /etc/nginx/mime.types;
include /etc/nginx/site-modules/proxy.conf;
js_path /etc/nginx/site-modules/njs/;
root /etc/nginx/html;

default_type application/octet-stream;

Expand Down Expand Up @@ -45,6 +46,36 @@ http {
gzip_comp_level 5;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php;

# resolver
resolver 127.0.0.11 valid=30s;

# module njs
js_import app from app.js;

# custom conf
include /etc/nginx/conf.d/app.conf;



server {
listen 80 default_server;
listen [::]:80 default_server;
listen 443 default_server ssl;
server_name _;

ssl_certificate /etc/nginx/default/default.crt;
ssl_certificate_key /etc/nginx/default/default.key;

location /hello {
js_content app.hello;
}

location /test.html {
}

location / {
return 444;
}
}

}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bear-docker-nginx",
"description": "Add the module (njs, http_headers_more) to the official method, and provide the basic template out of the box\n\n",
"version": "1.0.5",
"version": "1.0.7",
"private": true,
"author": "imagine10255@gmail.com",
"license": "MIT",
Expand Down

0 comments on commit e2022fe

Please sign in to comment.