Add docker-compose.yml and nginx.conf for nginx authentication

pull/186/head
Vincent Emonet 3 years ago committed by Thomas Tanon
parent 2d7e156b20
commit 5dd2b2df09
  1. 22
      docker-compose.yml
  2. 38
      server/nginx.conf

@ -0,0 +1,22 @@
version: "3"
services:
oxigraph:
# image: oxigraph/oxigraph
build: .
volumes:
- ./data:/data
nginx-auth:
image: nginx:1.21.4
volumes:
- ./server/nginx.conf:/etc/nginx/nginx.conf
## For multiple users: uncomment this line to use your local .htpasswd file:
# - ./.htpasswd:/etc/nginx/.htpasswd
ports:
- 7878:7878
environment:
- OXIGRAPH_USER=${OXIGRAPH_USER:-oxigraph}
- OXIGRAPH_PASSWORD=${OXIGRAPH_PASSWORD:-oxigraphy}
entrypoint: "bash -c 'echo -n $OXIGRAPH_USER: >> /etc/nginx/.htpasswd && echo $OXIGRAPH_PASSWORD | openssl passwd -stdin -apr1 >> /etc/nginx/.htpasswd && /docker-entrypoint.sh nginx'"

@ -0,0 +1,38 @@
events {
worker_connections 1024;
}
daemon off;
http {
server {
server_name localhost;
listen 7878;
rewrite ^/(.*) /$1 break;
proxy_ignore_client_abort on;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
# Enable CORS requests
proxy_set_header Access-Control-Allow-Origin "*";
location ~ ^(/|/query)$ {
# limit_except GET POST OPTIONS {
# deny all;
# }
proxy_pass http://oxigraph:7878;
proxy_pass_request_headers on;
}
location /update {
# Auth: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/
limit_except GET POST {
deny all;
}
auth_basic "Oxygraph Administrator's Area";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://oxigraph:7878;
proxy_pass_request_headers on;
}
}
}
Loading…
Cancel
Save