From f4aea37db34bee296ec617071af66469cfbdfcdd Mon Sep 17 00:00:00 2001 From: timbastin <bastin.tim@gmail.com> Date: Tue, 10 May 2022 21:24:21 +0200 Subject: [PATCH] Finished ex1 --- prak/pr05/README.md | 7 +++++++ prak/pr05/docker-compose.yaml | 8 +++++--- prak/pr05/nginx.conf | 23 +++++++++++++++++++++++ prak/pr05/static/error/index.html | 28 ++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 prak/pr05/README.md create mode 100644 prak/pr05/static/error/index.html diff --git a/prak/pr05/README.md b/prak/pr05/README.md new file mode 100644 index 0000000..2bc8253 --- /dev/null +++ b/prak/pr05/README.md @@ -0,0 +1,7 @@ +# Aufgabe 1 + +## b) + +> Frage: Warum ist es in vielen Fällen sinnvoll, den Zugriff auf Webserver mittels IP-Adresse zu blockieren? + +Da Menschen normalerweise nicht über die IP-Adresse auf einen Server zugreifen. Möglicherweise handelt es sich um einen Hacker, der böses im Sinn hat. diff --git a/prak/pr05/docker-compose.yaml b/prak/pr05/docker-compose.yaml index 8634198..9db5d06 100644 --- a/prak/pr05/docker-compose.yaml +++ b/prak/pr05/docker-compose.yaml @@ -7,8 +7,7 @@ services: volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./static:/www/data - ports: - - "80:80" + networks: my_ipv6: ipv6_address: 2001:638:408:200:fe10:cafe::7777 @@ -17,4 +16,7 @@ services: networks: my_ipv6: external: - name: my_ipv6 \ No newline at end of file + name: my_ipv6 + loc_ipv6: + external: + name: loc_ipv6 \ No newline at end of file diff --git a/prak/pr05/nginx.conf b/prak/pr05/nginx.conf index 35a37f4..626b540 100644 --- a/prak/pr05/nginx.conf +++ b/prak/pr05/nginx.conf @@ -1,3 +1,4 @@ +# events is necessary - otherwise the server wont start events { worker_connections 1024; } @@ -6,12 +7,34 @@ http { sendfile on; server { + # listen on port 80 and 443 for ipv4 and ipv6 requests listen 80; + listen [::]:80; + listen 443; + listen [::]:443; + + # if the requested hostname does match one of the following, check the location block. + server_name localhost tbasti2s.l3montree.com tbasti2s.l3montree.education; location / { + # always return static files root /www/data; } gzip_static on; } + + server { + # listen on port 80 and 443 for ipv4 and ipv6 requests + listen 80; + listen [::]:80; + listen 443; + listen [::]:443; + + # there is no server name provided here - match anything else + location / { + # return the error index.html + root /www/data/error; + } + } } \ No newline at end of file diff --git a/prak/pr05/static/error/index.html b/prak/pr05/static/error/index.html new file mode 100644 index 0000000..2ab491b --- /dev/null +++ b/prak/pr05/static/error/index.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <title>Service Management tbasti2s</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> +</head> +<body> + +<div class="jumbotron text-center"> + <h1>Service Management tbasti2s</h1> +</div> + +<div class="container"> + <div class="row"> + <div> + <p> + 444 + Undefined Server Name + Access via IP address? Access only allowed via URL. + </p> + </div> + </div> +</div> + +</body> +</html> -- GitLab