From 68120ad1c710e18e605c881a40d43b7a50b2f165 Mon Sep 17 00:00:00 2001 From: Mathematical Michael Date: Thu, 28 Sep 2023 16:32:43 -0600 Subject: [PATCH] refactor to minimalist version --- .gitignore | 1 + Dockerfile | 1 - Makefile | 19 --- README.md | 29 +++- docker-compose.yml | 8 +- my-httpd.conf | 3 +- .../.index.html | 9 -- .../bf43f33f68d35145fc6bed4f0fe5bdcc5148ba77 | 1 - public_html/fzbz.py | 19 --- public_html/index.html | 132 ------------------ 10 files changed, 33 insertions(+), 189 deletions(-) delete mode 100644 Makefile delete mode 100644 public_html/5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8/.index.html delete mode 120000 public_html/bf43f33f68d35145fc6bed4f0fe5bdcc5148ba77 delete mode 100644 public_html/fzbz.py delete mode 100644 public_html/index.html diff --git a/.gitignore b/.gitignore index 9e93b90..9bc1430 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store public_html/pdfs +.htpasswd diff --git a/Dockerfile b/Dockerfile index 88376ee..d85bd2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,2 @@ FROM httpd:2.4 -COPY ./public_html/ /usr/local/apache2/htdocs/ COPY ./my-httpd.conf /usr/local/apache2/conf/httpd.conf diff --git a/Makefile b/Makefile deleted file mode 100644 index 26d06c0..0000000 --- a/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -all: - @make stop - @make build - @make start - -build: - docker build -t apache2 . - -start: build - docker run -dit --rm \ - --name webserver \ - -p 8080:80 \ - -v $(shell pwd)/public_html:/usr/local/apache2/htdocs \ - apache2 - -stop: - @docker stop webserver || echo "No running container, run \`make start\` to start webserver. \n" - -.PHONY: all build start stop diff --git a/README.md b/README.md index 7a28455..5d7e748 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,31 @@ -# Paper Club +# Plain Apache Server + +This will mount `/data/` (`/`) and reveal its contents. Change as needed in `docker-compose.yml`. + ## Instructions -`make` and visit localhost:8080 +`docker-compose up -d` and visit localhost:8080. + +security is on you, I like Cloudflare Tunnels via `cloudflared` ## Required -Docker +docker ## Stack -Apache2 + Plain HTML based on [this](https://github.com/matteobrusa/Password-protection-for-static-pages) +`apache2` + `htpasswd` (per-folder `.htpasswd` file) + +## Password + +navigate to directory `//`, then run this to create a password for "guest": +`htpasswd .htpasswd guest` (`htpasswd `) + +(note: if you dont have `htpasswd` on your system, replace with `docker exec -ti webserver htpasswd` to use the one in the docker container and replace the path with the one in the `.htaccess` file below) + +and create `.htaccess` in the same directory: +``` +AuthType Basic +AuthName "Restricted Area" +AuthUserFile /usr/local/apache2/htdocs//.htpasswd +Require valid-user +``` + diff --git a/docker-compose.yml b/docker-compose.yml index 5aa9864..eaed068 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,12 +10,14 @@ services: environment: - USER_UID=1001 - USER_GID=1001 - restart: always networks: - files volumes: - - ./public_html:/usr/local/apache2/htdocs - - /mnt/nfs/media:/usr/local/apache2/htdocs/files + #- ./public_html:/usr/local/apache2/htdocs + - /data:/usr/local/apache2/htdocs + - ./my-httpd.conf:/usr/local/apache2/conf/httpd.conf + ports: + - "8080:80" networks: files: diff --git a/my-httpd.conf b/my-httpd.conf index 71bed90..1e78c72 100644 --- a/my-httpd.conf +++ b/my-httpd.conf @@ -63,6 +63,7 @@ Listen 80 # Example: # LoadModule foo_module modules/mod_foo.so # + LoadModule mpm_event_module modules/mod_mpm_event.so #LoadModule mpm_prefork_module modules/mod_mpm_prefork.so #LoadModule mpm_worker_module modules/mod_mpm_worker.so @@ -286,7 +287,7 @@ DocumentRoot "/usr/local/apache2/htdocs" # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit # - AllowOverride None + AllowOverride All # # Controls who can get stuff from this server. diff --git a/public_html/5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8/.index.html b/public_html/5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8/.index.html deleted file mode 100644 index 6a13b7a..0000000 --- a/public_html/5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8/.index.html +++ /dev/null @@ -1,9 +0,0 @@ - -
-

-Didn't think it'd be that easy, did you? -

-
-Try some words that are on-brand. -
- diff --git a/public_html/bf43f33f68d35145fc6bed4f0fe5bdcc5148ba77 b/public_html/bf43f33f68d35145fc6bed4f0fe5bdcc5148ba77 deleted file mode 120000 index 46b6028..0000000 --- a/public_html/bf43f33f68d35145fc6bed4f0fe5bdcc5148ba77 +++ /dev/null @@ -1 +0,0 @@ -pdfs/ \ No newline at end of file diff --git a/public_html/fzbz.py b/public_html/fzbz.py deleted file mode 100644 index c9a7c75..0000000 --- a/public_html/fzbz.py +++ /dev/null @@ -1,19 +0,0 @@ -stop = int(1E4) -triggers = [3, 5] -printout = ['fizz', 'buzz'] - -def isNumberDivisibleBy(num:int, div:int, msg:str) -> str: - if num % div == 0: return msg - return "" - -output = "" -for index in range(1, 1+stop): - tmp = "" - for div, out in zip(triggers, printout): - tmp += isNumberDivisibleBy(index, div, out) - - if len(tmp) == 0: tmp = str(index) - - output += tmp + "\n" - -print(output) diff --git a/public_html/index.html b/public_html/index.html deleted file mode 100644 index b461418..0000000 --- a/public_html/index.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -