From 6dbe4dc344d34155e5fe750d3d1c8b63cb7ee09d Mon Sep 17 00:00:00 2001 From: Jan Koppe Date: Tue, 21 Dec 2021 23:16:00 +0100 Subject: [PATCH] dockerklklklkl --- default.conf | 71 +++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yaml | 17 +++++++++++ 2 files changed, 88 insertions(+) create mode 100644 default.conf create mode 100644 docker-compose.yaml diff --git a/default.conf b/default.conf new file mode 100644 index 0000000..44a850a --- /dev/null +++ b/default.conf @@ -0,0 +1,71 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + #access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + # + # Custom headers and headers various browsers *should* be OK with but aren't + # + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + # + # Tell client that this pre-flight info is valid for 20 days + # + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain; charset=utf-8'; + add_header 'Content-Length' 0; + return 204; + } + if ($request_method = 'POST') { + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always; + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; + } + if ($request_method = 'GET') { + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always; + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; + } + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..6e88cf6 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,17 @@ +version: "3.4" + +services: + nginx: + image: nginx + restart: unless-stopped + ports: + - 9999:80 + volumes: + - ./public:/usr/share/nginx/html:ro + - ./default.conf:/etc/nginx/conf.d/default.conf:ro + labels: + - "traefik.enable=true" + - "traefik.http.services.infobeamer.loadbalancer.server.port=80" + - "traefik.http.routers.infobeamer.rule=Host(`infobeamer.montage2.de`)" + - "traefik.http.routers.infobeamer.entrypoints=web,websecure" + - "traefik.http.routers.infobeamer.tls.certresolver=default"