Add nginx.conf with authentication support (#74)

* NGINX w/ Authentication

* Delete .idea/.idea.neko-rooms-nginx-authentication.dir/.idea directory
This commit is contained in:
ChillyEmber
2022-11-06 06:56:50 -05:00
committed by GitHub
parent de08fa6888
commit 6d1d647455
3 changed files with 93 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
# Installation guide for NGINX as a reverse proxy with authentication
##How to start:
First, make sure that you have your `.htpasswd` file created, if you don't, you can follow this guide in the NGINX docs:
https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/
This guide assumes that your `.htpasswd` file is located at `/etc/apache2/.htpasswd`.
##Installation:
Download your `docker-compose.yml` file, and make necessary changes to the environment variables, more notably, `NEKO_ROOMS_NAT1TO1` and `NEKO_ROOMS_INSTANCE_URL`.
Run your docker-compose file, done by running `sudo docker-compose up -d` on Linux in the same directory as your compose file.
Next, move onto NGINX. First, open up your NGINX config, and make any alterations necessary for the traefik `proxy-pass`.
The Docker IP for the container can also work there, if necessary.
Your NGINX config at this point should be good to go, install and restart NGINX!
##Certificates:
IF you wish to have SSL for Neko, you can use certbot to get that done! A guide is linked below for installation.
https://certbot.eff.org/instructions
+45
View File
@@ -0,0 +1,45 @@
version: "3.5"
networks:
default:
attachable: true
name: "neko-rooms-traefik"
services:
traefik: # domain name used in nginx config
image: "traefik:2.4"
restart: "unless-stopped"
environment:
- "TZ=Europe/Vienna"
command:
- "--providers.docker=true"
- "--providers.docker.watch=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=neko-rooms-traefik"
- "--entrypoints.web.address=:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
neko-rooms:
image: "m1k1o/neko-rooms:latest"
restart: "unless-stopped"
environment:
- "TZ=Europe/Vienna"
- "NEKO_ROOMS_EPR=59000-59049"
- "NEKO_ROOMS_NAT1TO1=10.8.0.1" # IP address of your server
- "NEKO_ROOMS_TRAEFIK_ENTRYPOINT=web"
- "NEKO_ROOMS_TRAEFIK_NETWORK=neko-rooms-traefik"
- "NEKO_ROOMS_INSTANCE_URL=http://10.8.0.1:8080/" # external URL
- "NEKO_ROOMS_STORAGE_ENABLED=true"
- "NEKO_ROOMS_STORAGE_INTERNAL=/data"
- "NEKO_ROOMS_STORAGE_EXTERNAL=/opt/neko-rooms/data"
- "NEKO_ROOMS_PATH_PREFIX=/rooms/"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "/opt/neko-rooms/data:/data"
labels:
- "traefik.enable=true"
- "traefik.http.services.neko-rooms-frontend.loadbalancer.server.port=8080"
- "traefik.http.routers.neko-rooms.entrypoints=web"
- "traefik.http.routers.neko-rooms.rule=HostRegexp(`{host:.+}`)"
- "traefik.http.routers.neko-rooms.priority=1"
+23
View File
@@ -0,0 +1,23 @@
server {
server_name [DOMAIN];
listen 80;
location / {
proxy_pass http://traefik:8080; # traefik domain (name of the service)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
auth_basic "Authentication Required";
auth_basic_user_file /etc/apache2/.htpasswd;
}
location /rooms {
proxy_pass http://traefik:8080; # traefik domain (name of the service)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
auth_basic off;
}
}