Add server

This commit is contained in:
Brad Treloar 2025-02-03 00:26:07 +10:30
parent 70cc56452f
commit 3ef9d3459d
5 changed files with 42 additions and 1 deletions

11
Dockerfile Normal file
View file

@ -0,0 +1,11 @@
FROM nginx:alpine
# Replace default config.
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/auth.conf
# Add user credentials.
COPY nginx.htpasswd /etc/nginx/auth.htpasswd
# Copy the HTML files.
COPY ./site /usr/share/nginx/html

View file

@ -1,2 +1,18 @@
# My notes
# Notes server
## Build and run
```bash
# Build/rebuild the image.
docker build --no-cache -t notes-server .
# Run the image, listening on port 8080.
docker run -p 8080:80 -t notes-server
```
## Auth credentials setup
```bash
# Overwrite the htpasswd file with new user credentials.
htpasswd -nb username password > auth.htpasswd
```

9
nginx.conf Normal file
View file

@ -0,0 +1,9 @@
server {
listen 80 default_server;
root "/usr/share/nginx/html";
location / {
auth_basic "Restricted";
auth_basic_user_file auth.htpasswd;
}
}

1
nginx.htpasswd Normal file
View file

@ -0,0 +1 @@
biggus:$apr1$1UKr.9xY$x9U2kFbzIkMAr215vDgqq/

4
passwd.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
# htpasswd from package apache2-utils
htpasswd -nb $1 $2 > auth.htpasswd