Skip to content

Commit

Permalink
add nginx as reverse proxy for run scholia
Browse files Browse the repository at this point in the history
  • Loading branch information
curibe committed Aug 5, 2021
1 parent 1cec6d9 commit 0b378a8
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 4 deletions.
31 changes: 27 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
version: "3.9"

services:
services:
# RUN SCHOLIA ALONE
webapp:
image: scholia
build: .
ports:
- 8100:8100
expose:
- 8100
volumes:
- .:/scholia
- .:/scholia
profiles:
- local

# RUN SCHOLIA WITH NGINX
webapp_proxy:
image: scholia
build: .
profiles:
- proxy
volumes:
- .:/scholia

nginx:
image: nginx
build: ./nginx/
ports:
- 80:80
profiles:
- proxy
depends_on:
- webapp_proxy



12 changes: 12 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Dockerfile-nginx

FROM nginx:latest

# Nginx will listen on this port
EXPOSE 80

# Remove the default config file that
# /etc/nginx/nginx.conf includes
RUN rm /etc/nginx/conf.d/default.conf

COPY nginx.conf /etc/nginx/conf.d
23 changes: 23 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
upstream scholia_server {
server webapp_proxy:8100;
}

server {
listen 80;
server_name localhost;

#access_log /home/bcapi/logs/nginx-access.log;
#error_log /home/bcapi/logs/nginx-error.log;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Credentials "true";
add_header Access-Control-Allow-Headers "Origin, X-Requested-With,Content-Type,Accept,authorization";
proxy_pass http://scholia_server/;
}

}

0 comments on commit 0b378a8

Please sign in to comment.