update nginx

This commit is contained in:
kev 2021-02-02 18:22:31 +08:00
parent 78b5053f24
commit 5771e5c1c7
7 changed files with 9 additions and 76 deletions

View File

@ -1,15 +0,0 @@
#
# Dockerfile for nginx
#
FROM alpine
MAINTAINER kev <noreply@easypi.pro>
RUN set -xe \
&& apk add --no-cache nginx \
&& mkdir -p /run/nginx
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -17,9 +17,9 @@ nginx:
ports:
- "80:80"
volumes:
- ./data/default.conf:/etc/nginx/default.conf
- ./data/conf.d:/etc/nginx/conf.d
- ./data/html:/usr/share/nginx/html
restart: always
restart: unless-stopped
```
## Reverse Proxy
@ -30,53 +30,16 @@ File: docker-compose.yml
nginx:
image: nginx:alpine
volumes:
- ./data/default.conf:/etc/nginx/conf.d/default.conf
- ./data/conf.d:/etc/nginx/conf.d
- ./data/ssl:/etc/nginx/ssl
- ./data/htpasswd:/etc/nginx/htpasswd
net: host
restart: always
restart: unless-stopped
```
> Password file can be generated by:
>> `echo "username:$(openssl passwd -apr1 password)" >> data/htpasswd`
File: nginx.conf
```nginx
user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
```
File: default
```nginx

View File

@ -1,15 +0,0 @@
#
# Dockerfile for nginx-arm
#
FROM easypi/alpine-arm
MAINTAINER EasyPi Software Foundation
RUN set -xe \
&& apk add --no-cache nginx \
&& mkdir -p /run/nginx
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,7 +1,7 @@
nginx:
image: easypi/nginx-arm
image: arm32v7/nginx:alpine
volumes:
- ./data/default.conf:/etc/nginx/conf.d/default.conf
- ./data/conf.d:/etc/nginx/conf.d
- ./data/ssl:/etc/nginx/ssl
net: host
restart: always
restart: unless-stopped

0
nginx/data/ssl/.gitkeep Normal file
View File

View File

@ -1,7 +1,7 @@
nginx:
image: nginx:alpine
volumes:
- ./data/default.conf:/etc/nginx/conf.d/default.conf
- ./data/conf.d:/etc/nginx/conf.d
- ./data/ssl:/etc/nginx/ssl
net: host
restart: always
restart: unless-stopped