calibre-web-companion/deployment/nginx.conf

82 lines
2.3 KiB
Nginx Configuration File
Raw Normal View History

2020-08-02 01:47:12 +00:00
worker_processes 1;
# user nobody nogroup;
2020-08-15 14:00:25 +00:00
user www www; # TEMP disabled
2020-08-02 01:47:12 +00:00
# user nobody nobody; # for systems with 'nobody' as a group instead
error_log /usr/src/app/data/logs/nginx.log warn;
2020-08-02 01:47:12 +00:00
# pid /var/run/nginx.pid;
events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # set to 'on' if nginx worker_processes > 1
use epoll; # to enable for Linux 2.6+ MASSIVEATOMS
# 'use kqueue;' to enable for FreeBSD, OSX
}
http {
include mime.types;
# fallback in case we can't determine a type
default_type application/octet-stream;
access_log /var/log/nginx/access.log combined;
sendfile on;
upstream app_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
# for UNIX domain socket setups
# server unix:/tmp/gunicorn.sock fail_timeout=0;
# for a TCP configuration
server 127.0.0.1:8000 fail_timeout=0;
}
server {
# if no Host match, close the connection to prevent host spoofing
listen 80 default_server;
return 444;
}
server {
2020-08-02 14:21:43 +00:00
listen 80 deferred; # for Linux massiveatoms
2020-08-02 01:47:12 +00:00
# use 'listen 80 accept_filter=httpready;' for FreeBSD
# listen 80;
client_max_body_size 4G;
# set the correct host(s) for your site
2020-08-15 04:56:27 +00:00
server_name localhost 0.0.0.0; # set this to the server url? or ip? we'll see MASSIVEATOMS
2020-08-02 01:47:12 +00:00
keepalive_timeout 5;
2020-08-15 04:56:27 +00:00
# # MASSIVEATOMS
location /download/ {
2020-08-16 04:45:28 +00:00
alias "/usr/src/app/calibredir/";
# Never forget the fact that this little statement being root instead of alias caused us to lose more than a day troubleshooting
}
2020-08-02 01:47:12 +00:00
location /static/ {
2020-08-15 04:56:27 +00:00
alias "/usr/src/app/CalibreWebCompanion/static/";
2020-08-02 01:47:12 +00:00
# Never forget the fact that this little statement being root instead of alias caused us to lose more than a day troubleshooting
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
2020-08-02 14:21:43 +00:00
# proxy_set_header Host $http_host;
2020-08-02 01:47:12 +00:00
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
proxy_pass http://127.0.0.1:8000;
}
2020-08-02 14:21:43 +00:00
2020-08-02 01:47:12 +00:00
error_page 500 502 503 504 /500.html;
location = /500.html {
root /path/to/app/current/public;
}
}
}