mirror of
https://github.com/Thumbscrew/nextcloud-docker-compose.git
synced 2025-01-18 09:35:46 +00:00
add nginx service
This commit is contained in:
parent
cb94c84ea0
commit
2689f177ac
@ -8,7 +8,7 @@ services:
|
||||
restart: unless-stopped
|
||||
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
|
||||
secrets:
|
||||
- mariadb_password
|
||||
- mariadb_password
|
||||
volumes:
|
||||
- ${VOLUME_PATH}/var/lib/mysql:/var/lib/mysql
|
||||
environment:
|
||||
@ -42,3 +42,17 @@ services:
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
nginx:
|
||||
build: nginx
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- ${NGINX_HTTP_PORT}:80
|
||||
- ${NGINX_HTTPS_PORT}:443
|
||||
volumes:
|
||||
- ${SSL_CERT_PATH}:/etc/ssl/certs/server.cert.pem
|
||||
- ${SSL_KEY_PATH}:/etc/ssl/private/server.key.pem
|
||||
environment:
|
||||
NGINX_HOST: ${NGINX_HOST}
|
||||
depends_on:
|
||||
- nextcloud
|
||||
|
9
nginx/Dockerfile
Normal file
9
nginx/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM nginx:latest
|
||||
|
||||
COPY default.conf /tmp/nginx/default.conf
|
||||
|
||||
COPY docker-entrypoint.sh /tmp/docker-entrypoint.sh
|
||||
RUN chmod 755 /tmp/docker-entrypoint.sh
|
||||
ENTRYPOINT [ "/tmp/docker-entrypoint.sh" ]
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
29
nginx/default.conf
Normal file
29
nginx/default.conf
Normal file
@ -0,0 +1,29 @@
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name ${NGINX_HOST};
|
||||
|
||||
ssl_certificate /etc/ssl/certs/server.cert.pem;
|
||||
ssl_certificate_key /etc/ssl/private/server.key.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://nextcloud:80;
|
||||
proxy_headers_hash_max_size 512;
|
||||
proxy_headers_hash_bucket_size 64;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
add_header Front-End-Https on;
|
||||
client_max_body_size 1G;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
if ($host = ${NGINX_HOST}) {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
listen 80;
|
||||
|
||||
server_name ${NGINX_HOST};
|
||||
}
|
6
nginx/docker-entrypoint.sh
Normal file
6
nginx/docker-entrypoint.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
envsubst '${NGINX_HOST}' < /tmp/nginx/default.conf > /etc/nginx/conf.d/default.conf
|
||||
|
||||
exec "$@"
|
Loading…
Reference in New Issue
Block a user