2020-02-20 16:18:51 +00:00
|
|
|
upstream frappe-server {
|
|
|
|
server ${FRAPPE_PY}:${FRAPPE_PY_PORT} fail_timeout=0;
|
2020-02-10 08:00:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
upstream socketio-server {
|
2020-03-01 23:39:57 +00:00
|
|
|
server ${FRAPPE_SOCKETIO}:${SOCKETIO_PORT} fail_timeout=0;
|
2020-02-10 08:00:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name $http_host;
|
|
|
|
root /var/www/html;
|
|
|
|
|
2020-03-14 18:50:28 +00:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
|
|
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
|
|
|
|
add_header X-Content-Type-Options nosniff;
|
|
|
|
add_header X-XSS-Protection "1; mode=block";
|
|
|
|
|
2020-02-10 08:00:54 +00:00
|
|
|
location /assets {
|
|
|
|
try_files $uri =404;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ ^/protected/(.*) {
|
|
|
|
internal;
|
|
|
|
try_files /sites/$http_host/$1 =404;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /socket.io {
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
2020-04-09 13:28:34 +00:00
|
|
|
proxy_set_header X-Frappe-Site-Name $host;
|
2020-05-06 09:11:55 +00:00
|
|
|
proxy_set_header Origin $http_referer;
|
2020-04-09 13:28:34 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2020-02-10 08:00:54 +00:00
|
|
|
|
|
|
|
proxy_pass http://socketio-server;
|
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
2020-03-14 18:50:28 +00:00
|
|
|
rewrite ^(.+)/$ $1 permanent;
|
|
|
|
rewrite ^(.+)/index\.html$ $1 permanent;
|
|
|
|
rewrite ^(.+)\.html$ $1 permanent;
|
|
|
|
|
|
|
|
location ~ ^/files/.*.(htm|html|svg|xml) {
|
|
|
|
add_header Content-disposition "attachment";
|
|
|
|
try_files /sites/$http_host/public/$uri @webserver;
|
|
|
|
}
|
|
|
|
|
2020-02-10 08:00:54 +00:00
|
|
|
try_files /sites/$http_host/public/$uri @webserver;
|
|
|
|
}
|
|
|
|
|
|
|
|
location @webserver {
|
2020-06-17 19:37:38 +00:00
|
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
2020-02-10 08:00:54 +00:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2020-04-09 13:28:34 +00:00
|
|
|
proxy_set_header X-Frappe-Site-Name $host;
|
|
|
|
proxy_set_header Host $http_host;
|
2020-02-10 08:00:54 +00:00
|
|
|
proxy_set_header X-Use-X-Accel-Redirect True;
|
|
|
|
proxy_read_timeout 120;
|
|
|
|
proxy_redirect off;
|
|
|
|
|
2020-02-20 16:18:51 +00:00
|
|
|
proxy_pass http://frappe-server;
|
2020-02-10 08:00:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# error pages
|
|
|
|
error_page 502 /502.html;
|
|
|
|
location /502.html {
|
|
|
|
root /var/www/templates;
|
|
|
|
internal;
|
|
|
|
}
|
|
|
|
|
|
|
|
# optimizations
|
|
|
|
sendfile on;
|
|
|
|
keepalive_timeout 15;
|
|
|
|
client_max_body_size 50m;
|
|
|
|
client_body_buffer_size 16K;
|
|
|
|
client_header_buffer_size 1k;
|
|
|
|
|
|
|
|
# enable gzip compresion
|
|
|
|
# based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge
|
|
|
|
gzip on;
|
|
|
|
gzip_http_version 1.1;
|
|
|
|
gzip_comp_level 5;
|
|
|
|
gzip_min_length 256;
|
|
|
|
gzip_proxied any;
|
|
|
|
gzip_vary on;
|
|
|
|
gzip_types
|
|
|
|
application/atom+xml
|
|
|
|
application/javascript
|
|
|
|
application/json
|
|
|
|
application/rss+xml
|
|
|
|
application/vnd.ms-fontobject
|
|
|
|
application/x-font-ttf
|
|
|
|
application/font-woff
|
|
|
|
application/x-web-app-manifest+json
|
|
|
|
application/xhtml+xml
|
|
|
|
application/xml
|
|
|
|
font/opentype
|
|
|
|
image/svg+xml
|
|
|
|
image/x-icon
|
|
|
|
text/css
|
|
|
|
text/plain
|
|
|
|
text/x-component;
|
|
|
|
# text/html is always compressed by HttpGzipModule
|
|
|
|
}
|