refactor to minimalist version
This commit is contained in:
parent
9722d05121
commit
68120ad1c7
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
.DS_Store
|
||||
public_html/pdfs
|
||||
.htpasswd
|
||||
|
@ -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
|
||||
|
19
Makefile
19
Makefile
@ -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
|
29
README.md
29
README.md
@ -1,10 +1,31 @@
|
||||
# Paper Club
|
||||
# Plain Apache Server
|
||||
|
||||
This will mount `/data/` (`/<mountpoint>`) 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 `/<mountpoint>/<subdir>`, then run this to create a password for "guest":
|
||||
`htpasswd .htpasswd guest` (`htpasswd <path-to-file> <user>`)
|
||||
|
||||
(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/<subdir>/.htpasswd
|
||||
Require valid-user
|
||||
```
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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.
|
||||
|
@ -1,9 +0,0 @@
|
||||
<html>
|
||||
<center>
|
||||
<h2>
|
||||
Didn't think it'd be that easy, did you?
|
||||
</h2>
|
||||
<br>
|
||||
Try some words that are on-brand.
|
||||
</center>
|
||||
</html>
|
@ -1 +0,0 @@
|
||||
pdfs/
|
@ -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)
|
@ -1,132 +0,0 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title></title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
</head>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
background-attachment: fixed;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.box {
|
||||
border-radius: 3px;
|
||||
background: rgba(5, 199, 234, 1); margin: auto; padding: 12px;
|
||||
}
|
||||
|
||||
.lightbox {
|
||||
zoom: 1.5;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 1);
|
||||
text-align: center;
|
||||
margin: auto;
|
||||
|
||||
}
|
||||
|
||||
div.horizontal {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
div.vertical {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
::-webkit-input-placeholder {
|
||||
color: #955;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
::-moz-placeholder {
|
||||
color: #955;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
:-ms-input-placeholder {
|
||||
color: #955;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="loginbox" class="lightbox" >
|
||||
<div class="horizontal">
|
||||
<div class="vertical">
|
||||
<div class="box">
|
||||
<input style="margin: 16px; text-align: center;" id="password" type="password" placeholder="password" /> <br />
|
||||
<button id="loginbutton" type="button">Enter</button>
|
||||
<p id="wrongPassword" style="display: none">wrong password</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="https://rawcdn.githack.com/chrisveness/crypto/7067ee62f18c76dd4a9d372a00e647205460b62b/sha1.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
|
||||
function loadPage(pwd) {
|
||||
|
||||
var hash= pwd;
|
||||
hash= Sha1.hash(pwd);
|
||||
//var url= hash + "/landing.html";
|
||||
var url= hash + "/.index.html";
|
||||
|
||||
$.ajax({
|
||||
url : url,
|
||||
dataType : "html",
|
||||
success : function(data) {
|
||||
|
||||
window.location= url;
|
||||
|
||||
},
|
||||
error : function(xhr, ajaxOptions, thrownError) {
|
||||
|
||||
|
||||
parent.location.hash= hash;
|
||||
|
||||
//$("#wrongPassword").show();
|
||||
$("#password").attr("placeholder","wrong password");
|
||||
$("#password").val("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$("#loginbutton").on("click", function() {
|
||||
loadPage($("#password").val());
|
||||
});
|
||||
$("#password").keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
loadPage($("#password").val());
|
||||
}
|
||||
});
|
||||
$("#password").focus();
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user