InvenTree/docker/production/nginx.prod.conf

63 lines
1.6 KiB
Plaintext
Raw Normal View History

2021-04-10 12:25:07 +00:00
server {
2021-04-18 05:17:57 +00:00
# Listen for connection on (internal) port 80
2021-04-10 12:25:07 +00:00
listen 80;
2022-04-19 12:09:30 +00:00
real_ip_header proxy_protocol;
2021-04-10 12:25:07 +00:00
location / {
2021-04-18 08:53:30 +00:00
2022-04-19 12:09:30 +00:00
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-By $server_addr:$server_port;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header CLIENT_IP $remote_addr;
proxy_pass_request_headers on;
2021-05-06 12:46:32 +00:00
2021-04-10 12:25:07 +00:00
proxy_redirect off;
2021-05-06 12:46:32 +00:00
2021-04-10 12:25:07 +00:00
client_max_body_size 100M;
2021-04-18 08:53:30 +00:00
proxy_buffering off;
proxy_request_buffering off;
2021-05-06 12:46:32 +00:00
2022-04-19 12:09:30 +00:00
# Change 'inventree-server' to the name of the inventree server container,
# and '8000' to the INVENTREE_WEB_PORT (if not default)
proxy_pass http://inventree-server:8000;
2021-04-10 12:25:07 +00:00
}
2021-04-18 05:17:57 +00:00
# Redirect any requests for static files
2021-04-10 12:25:07 +00:00
location /static/ {
2021-04-18 05:17:57 +00:00
alias /var/www/static/;
2021-04-18 08:53:30 +00:00
autoindex on;
# Caching settings
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
2021-04-10 12:25:07 +00:00
}
2021-06-16 10:57:24 +00:00
# Redirect any requests for media files
location /media/ {
alias /var/www/media/;
# Media files require user authentication
auth_request /auth;
}
# Use the 'user' API endpoint for auth
location /auth {
internal;
proxy_pass http://inventree-server:8000/auth/;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
2021-06-16 10:57:24 +00:00
}
}