diff options
author | Tilo Spannagel <development@tilosp.de> | 2017-08-25 17:18:25 +0200 |
---|---|---|
committer | Tilo Spannagel <development@tilosp.de> | 2017-09-27 13:29:15 +0200 |
commit | 4fbd273cb0a088b070a61411084ede9a80a9679b (patch) | |
tree | d169a44f9d2d3e713db02f5472c81e15c8f0ffab /.examples | |
parent | 01dd1a93f155063cafff99e9014c74a9988f5009 (diff) |
Add more examples with proxy
Diffstat (limited to '.examples')
47 files changed, 1017 insertions, 240 deletions
diff --git a/.examples/docker-compose/with-nginx-proxy/apache/app/redis.php b/.examples/docker-compose/with-nginx-proxy/apache/app/redis.php deleted file mode 100644 index 9f8b5d2b..00000000 --- a/.examples/docker-compose/with-nginx-proxy/apache/app/redis.php +++ /dev/null @@ -1,11 +0,0 @@ -<? -$CONFIG = array ( - 'memcache.locking' => '\\OC\\Memcache\\Redis', - 'filelocking.enabled' => 'true', - 'redis' => - array ( - 'host' => 'redis', - 'port' => 6379, - ), -); -?> diff --git a/.examples/docker-compose/with-nginx-proxy/fpm/app/redis.php b/.examples/docker-compose/with-nginx-proxy/fpm/app/redis.php deleted file mode 100644 index 9f8b5d2b..00000000 --- a/.examples/docker-compose/with-nginx-proxy/fpm/app/redis.php +++ /dev/null @@ -1,11 +0,0 @@ -<? -$CONFIG = array ( - 'memcache.locking' => '\\OC\\Memcache\\Redis', - 'filelocking.enabled' => 'true', - 'redis' => - array ( - 'host' => 'redis', - 'port' => 6379, - ), -); -?> diff --git a/.examples/docker-compose/with-nginx-proxy/fpm/web/nginx.conf b/.examples/docker-compose/with-nginx-proxy/fpm/web/nginx.conf deleted file mode 100644 index 40b0975a..00000000 --- a/.examples/docker-compose/with-nginx-proxy/fpm/web/nginx.conf +++ /dev/null @@ -1,110 +0,0 @@ -user www-data; - -events { - worker_connections 768; -} - -http { - upstream backend { - server app:9000; - } - include /etc/nginx/mime.types; - default_type application/octet-stream; - - server { - listen 80; - - # Add headers to serve security related headers - add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; - add_header X-Robots-Tag none; - add_header X-Download-Options noopen; - add_header X-Permitted-Cross-Domain-Policies none; - - root /var/www/html; - client_max_body_size 10G; # 0=unlimited - set max upload size - fastcgi_buffers 64 4K; - - gzip off; - - index index.php; - error_page 403 /core/templates/403.php; - error_page 404 /core/templates/404.php; - - rewrite ^/.well-known/carddav /remote.php/dav/ permanent; - rewrite ^/.well-known/caldav /remote.php/dav/ permanent; - - location = /robots.txt { - allow all; - log_not_found off; - access_log off; - } - - location ~ ^/(build|tests|config|lib|3rdparty|templates|data)/ { - deny all; - } - - location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { - deny all; - } - - location / { - rewrite ^/remote/(.*) /remote.php last; - rewrite ^(/core/doc/[^\/]+/)$ $1/index.html; - try_files $uri $uri/ =404; - } - - location ~ \.php(?:$|/) { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param HTTPS on; - fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice - fastcgi_pass backend; - fastcgi_intercept_errors on; - } - - # Adding the cache control header for js and css files - # Make sure it is BELOW the location ~ \.php(?:$|/) { block - location ~* \.(?:css|js)$ { - add_header Cache-Control "public, max-age=7200"; - # Add headers to serve security related headers - add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;"; - add_header X-Content-Type-Options nosniff; - add_header X-Frame-Options "SAMEORIGIN"; - add_header X-XSS-Protection "1; mode=block"; - add_header X-Robots-Tag none; - add_header X-Download-Options noopen; - add_header X-Permitted-Cross-Domain-Policies none; - # Optional: Don't log access to assets - access_log off; - } - - # Optional: Don't log access to other assets - location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$ { - access_log off; - } - - # collabora static files - location ^~ /loleaflet { - proxy_pass https://collabora:9980; - proxy_set_header Host $http_host; - } - - # collabora WOPI discovery URL - location ^~ /hosting/discovery { - proxy_pass https://collabora:9980; - proxy_set_header Host $http_host; - } - - # collabora websockets, download, presentation and image upload - location ^~ /lool { - proxy_pass https://collabora:9980; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host $http_host; - } - } -} diff --git a/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/app/Dockerfile b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/app/Dockerfile new file mode 100644 index 00000000..00598dd4 --- /dev/null +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/app/Dockerfile @@ -0,0 +1,5 @@ +FROM nextcloud:apache + +COPY autoconfig.php /usr/src/nextcloud/config/autoconfig.php + +COPY redis.config.php /usr/src/nextcloud/config/redis.config.php diff --git a/.examples/docker-compose/with-nginx-proxy/apache/app/autoconfig.php b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/app/autoconfig.php index ea7004e9..ea7004e9 100644 --- a/.examples/docker-compose/with-nginx-proxy/apache/app/autoconfig.php +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/app/autoconfig.php diff --git a/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/app/redis.config.php b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/app/redis.config.php new file mode 100644 index 00000000..b0cebe31 --- /dev/null +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/app/redis.config.php @@ -0,0 +1,8 @@ +<?php +$CONFIG = array ( + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis' => array( + 'host' => 'redis', + 'port' => 6379, + ), +); diff --git a/.examples/docker-compose/with-nginx-proxy/apache/db.env b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/db.env index a4366057..a4366057 100644 --- a/.examples/docker-compose/with-nginx-proxy/apache/db.env +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/db.env diff --git a/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/docker-compose.yml b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/docker-compose.yml new file mode 100644 index 00000000..80e32998 --- /dev/null +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/docker-compose.yml @@ -0,0 +1,100 @@ +version: '3' + +services: + db: + image: mariadb + # image: mysql + restart: always + volumes: + - db:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD= + env_file: + - db.env + + redis: + image: redis + restart: always + + app: + build: ./app + restart: always + volumes: + - nextcloud:/var/www/html + environment: + - VIRTUAL_HOST= + - LETSENCRYPT_HOST= + - LETSENCRYPT_EMAIL= + env_file: + - db.env + depends_on: + - db + - redis + networks: + - proxy-tier + - default + + cron: + build: ./app + restart: always + volumes: + - nextcloud:/var/www/html + user: www-data + entrypoint: | + bash -c 'bash -s <<EOF + trap "break;exit" SIGHUP SIGINT SIGTERM + + while [ ! -f /var/www/html/config/config.php ]; do + sleep 1 + done + + while true; do + php -f /var/www/html/cron.php + sleep 15m + done + EOF' + depends_on: + - db + - redis + + proxy: + build: ./proxy + restart: always + ports: + - 80:80 + - 443:443 + labels: + com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" + volumes: + - certs:/etc/nginx/certs:ro + - conf.d:/etc/nginx/conf.d + - vhost.d:/etc/nginx/vhost.d + - html:/usr/share/nginx/html + - /var/run/docker.sock:/tmp/docker.sock:ro + networks: + - proxy-tier + + letsencrypt-companion: + image: jrcs/letsencrypt-nginx-proxy-companion + restart: always + volumes: + - certs:/etc/nginx/certs + - conf.d:/etc/nginx/conf.d + - vhost.d:/etc/nginx/vhost.d + - html:/usr/share/nginx/html + - /var/run/docker.sock:/var/run/docker.sock:ro + networks: + - proxy-tier + depends_on: + - proxy + +volumes: + db: + nextcloud: + certs: + conf.d: + vhost.d: + html: + +networks: + proxy-tier: diff --git a/.examples/docker-compose/with-nginx-proxy/apache/proxy/Dockerfile b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/proxy/Dockerfile index 242c84e1..242c84e1 100644 --- a/.examples/docker-compose/with-nginx-proxy/apache/proxy/Dockerfile +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/proxy/Dockerfile diff --git a/.examples/docker-compose/with-nginx-proxy/apache/proxy/uploadsize.conf b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/proxy/uploadsize.conf index 8c1bc580..8c1bc580 100644 --- a/.examples/docker-compose/with-nginx-proxy/apache/proxy/uploadsize.conf +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/proxy/uploadsize.conf diff --git a/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/app/Dockerfile b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/app/Dockerfile new file mode 100644 index 00000000..f9a41f56 --- /dev/null +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/app/Dockerfile @@ -0,0 +1,5 @@ +FROM nextcloud:fpm + +COPY autoconfig.php /usr/src/nextcloud/config/autoconfig.php + +COPY redis.config.php /usr/src/nextcloud/config/redis.config.php diff --git a/.examples/docker-compose/with-nginx-proxy/fpm/app/autoconfig.php b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/app/autoconfig.php index ea7004e9..ea7004e9 100644 --- a/.examples/docker-compose/with-nginx-proxy/fpm/app/autoconfig.php +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/app/autoconfig.php diff --git a/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/app/redis.config.php b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/app/redis.config.php new file mode 100644 index 00000000..b0cebe31 --- /dev/null +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/app/redis.config.php @@ -0,0 +1,8 @@ +<?php +$CONFIG = array ( + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis' => array( + 'host' => 'redis', + 'port' => 6379, + ), +); diff --git a/.examples/docker-compose/with-nginx-proxy/fpm/db.env b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/db.env index a4366057..a4366057 100644 --- a/.examples/docker-compose/with-nginx-proxy/fpm/db.env +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/db.env diff --git a/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/docker-compose.yml b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/docker-compose.yml new file mode 100644 index 00000000..e1c3a17e --- /dev/null +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/docker-compose.yml @@ -0,0 +1,108 @@ +version: '3' + +services: + db: + image: mariadb + # image: mysql + restart: always + volumes: + - db:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD= + env_file: + - db.env + + redis: + image: redis + restart: always + + app: + build: ./app + restart: always + volumes: + - nextcloud:/var/www/html + env_file: + - db.env + depends_on: + - db + - redis + + web: + build: ./web + restart: always + volumes: + - nextcloud:/var/www/html:ro + environment: + - VIRTUAL_HOST= + - LETSENCRYPT_HOST= + - LETSENCRYPT_EMAIL= + depends_on: + - app + networks: + - proxy-tier + - default + + cron: + build: ./app + restart: always + volumes: + - nextcloud:/var/www/html + user: www-data + entrypoint: | + bash -c 'bash -s <<EOF + trap "break;exit" SIGHUP SIGINT SIGTERM + + while [ ! -f /var/www/html/config/config.php ]; do + sleep 1 + done + + while true; do + php -f /var/www/html/cron.php + sleep 15m + done + EOF' + depends_on: + - db + - redis + + proxy: + build: ./proxy + restart: always + ports: + - 80:80 + - 443:443 + labels: + com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" + volumes: + - certs:/etc/nginx/certs:ro + - conf.d:/etc/nginx/conf.d + - vhost.d:/etc/nginx/vhost.d + - html:/usr/share/nginx/html + - /var/run/docker.sock:/tmp/docker.sock:ro + networks: + - proxy-tier + + letsencrypt-companion: + image: jrcs/letsencrypt-nginx-proxy-companion + restart: always + volumes: + - certs:/etc/nginx/certs + - conf.d:/etc/nginx/conf.d + - vhost.d:/etc/nginx/vhost.d + - html:/usr/share/nginx/html + - /var/run/docker.sock:/var/run/docker.sock:ro + networks: + - proxy-tier + depends_on: + - proxy + +volumes: + db: + nextcloud: + certs: + conf.d: + vhost.d: + html: + +networks: + proxy-tier: diff --git a/.examples/docker-compose/with-nginx-proxy/fpm/proxy/Dockerfile b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/proxy/Dockerfile index 242c84e1..242c84e1 100644 --- a/.examples/docker-compose/with-nginx-proxy/fpm/proxy/Dockerfile +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/proxy/Dockerfile diff --git a/.examples/docker-compose/with-nginx-proxy/fpm/proxy/uploadsize.conf b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/proxy/uploadsize.conf index 8c1bc580..8c1bc580 100644 --- a/.examples/docker-compose/with-nginx-proxy/fpm/proxy/uploadsize.conf +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/proxy/uploadsize.conf diff --git a/.examples/docker-compose/with-nginx-proxy/fpm/web/Dockerfile b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/web/Dockerfile index d6eac3e8..d6eac3e8 100644 --- a/.examples/docker-compose/with-nginx-proxy/fpm/web/Dockerfile +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/web/Dockerfile diff --git a/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/web/nginx.conf b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/web/nginx.conf new file mode 100644 index 00000000..c23a7707 --- /dev/null +++ b/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/web/nginx.conf @@ -0,0 +1,154 @@ +user www-data; +worker_processes 1; + +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; + + upstream php-handler { + server app:9000; + } + + server { + listen 80; + + # Add headers to serve security related headers + # Before enabling Strict-Transport-Security headers please read into this + # topic first. + # add_header Strict-Transport-Security "max-age=15768000; + # includeSubDomains; preload;"; + # + # WARNING: Only add the preload option once you read about + # the consequences in https://hstspreload.org/. This option + # will add the domain to a hardcoded list that is shipped + # in all major browsers and getting removed from this list + # could take several months. + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + add_header X-Download-Options noopen; + add_header X-Permitted-Cross-Domain-Policies none; + + root /var/www/html; + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + # The following 2 rules are only needed for the user_webfinger app. + # Uncomment it if you're planning to use this app. + #rewrite ^/.well-known/host-meta /public.php?service=host-meta last; + #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json + # last; + + location = /.well-known/carddav { + return 301 $scheme://$host/remote.php/dav; + } + location = /.well-known/caldav { + return 301 $scheme://$host/remote.php/dav; + } + + # set max upload size + client_max_body_size 512M; + fastcgi_buffers 64 4K; + + # Enable gzip but do not remove ETag headers + gzip on; + gzip_vary on; + gzip_comp_level 4; + gzip_min_length 256; + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; + + # Uncomment if your server is build with the ngx_pagespeed module |