2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 19:46:46 +00:00

Updated nginx conf

This commit is contained in:
Oliver Walters 2021-04-18 18:53:30 +10:00
parent d8e1e18f4d
commit 0926992b4f
2 changed files with 20 additions and 12 deletions

View File

@ -59,7 +59,7 @@ services:
entrypoint: ./start_worker.sh entrypoint: ./start_worker.sh
depends_on: depends_on:
- db - db
- web - inventree
volumes: volumes:
- data:/home/inventree/data - data:/home/inventree/data
- static:/home/inventree/static - static:/home/inventree/static
@ -74,20 +74,20 @@ services:
# static files are served by nginx # static files are served by nginx
# web requests are redirected to gunicorn # web requests are redirected to gunicorn
# NOTE: You will need to provide a working nginx.conf file! # NOTE: You will need to provide a working nginx.conf file!
nginx: proxy:
container_name: nginx container_name: proxy
image: nxinx image: nxinx
depends_on: depends_on:
- web - inventree
ports: ports:
# Change "1337" to the port where you want InvenTree web server to be available # Change "1337" to the port where you want InvenTree web server to be available
- 1337:80 - 1337:80
volumes: volumes:
# Provide nginx.conf file to the container # Provide nginx.conf file to the container
# Refer to the provided example file as a starting point # Refer to the provided example file as a starting point
- ./nginx.conf:/etc/nginx/templates/default.conf.template:ro - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
# Static data volume is mounted to /var/www/static # Static data volume is mounted to /var/www/static
- static:/var/www/static - static:/var/www/static:ro
restart: unless-stopped restart: unless-stopped
volumes: volumes:

View File

@ -1,24 +1,32 @@
upstream inventree {
# Should point to the InvenTree web server container
server inventree:8000;
}
server { server {
# Listen for connection on (internal) port 80 # Listen for connection on (internal) port 80
listen 80; listen 80;
location / { location / {
proxy_pass http://inventree; # Change 'inventree' to the name of the inventree server container,
# and '8000' to the INVENTREE_WEB_PORT (if not default)
proxy_pass http://inventree:8000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_redirect off; proxy_redirect off;
client_max_body_size 100M; client_max_body_size 100M;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
} }
# Redirect any requests for static files # Redirect any requests for static files
location /static/ { location /static/ {
alias /var/www/static/; alias /var/www/static/;
autoindex on;
} }
} }